/*      */ package hmc;
/*      */ 
/*      */ import Serialio.SerialConfig;
/*      */ import Serialio.SerialPortLocal;
/*      */ import com.jidesoft.swing.SimpleScrollPane;
/*      */ import java.awt.Color;
/*      */ import java.awt.Component;
/*      */ import java.awt.Container;
/*      */ import java.awt.Dimension;
/*      */ import java.awt.Font;
/*      */ import java.awt.FontMetrics;
/*      */ import java.awt.Rectangle;
/*      */ import java.awt.Toolkit;
/*      */ import java.awt.datatransfer.Clipboard;
/*      */ import java.awt.datatransfer.ClipboardOwner;
/*      */ import java.awt.datatransfer.DataFlavor;
/*      */ import java.awt.datatransfer.StringSelection;
/*      */ import java.awt.datatransfer.Transferable;
/*      */ import java.awt.datatransfer.UnsupportedFlavorException;
/*      */ import java.awt.event.ActionEvent;
/*      */ import java.awt.event.ActionListener;
/*      */ import java.awt.event.FocusEvent;
/*      */ import java.awt.event.FocusListener;
/*      */ import java.awt.event.KeyAdapter;
/*      */ import java.awt.event.KeyEvent;
/*      */ import java.awt.event.MouseAdapter;
/*      */ import java.awt.event.MouseEvent;
/*      */ import java.io.BufferedReader;
/*      */ import java.io.BufferedWriter;
/*      */ import java.io.ByteArrayOutputStream;
/*      */ import java.io.File;
/*      */ import java.io.FileReader;
/*      */ import java.io.FileWriter;
/*      */ import java.io.IOException;
/*      */ import java.io.PrintStream;
/*      */ import java.lang.management.ManagementFactory;
/*      */ import java.lang.management.ThreadMXBean;
/*      */ import java.text.SimpleDateFormat;
/*      */ import java.util.ArrayList;
/*      */ import java.util.Date;
/*      */ import java.util.Set;
/*      */ import java.util.TreeMap;
/*      */ import javax.swing.BorderFactory;
/*      */ import javax.swing.DefaultComboBoxModel;
/*      */ import javax.swing.DefaultListModel;
/*      */ import javax.swing.GroupLayout;
/*      */ import javax.swing.GroupLayout.Alignment;
/*      */ import javax.swing.GroupLayout.ParallelGroup;
/*      */ import javax.swing.GroupLayout.SequentialGroup;
/*      */ import javax.swing.ImageIcon;
/*      */ import javax.swing.JButton;
/*      */ import javax.swing.JComboBox;
/*      */ import javax.swing.JDialog;
/*      */ import javax.swing.JFileChooser;
/*      */ import javax.swing.JInternalFrame;
/*      */ import javax.swing.JLabel;
/*      */ import javax.swing.JList;
/*      */ import javax.swing.JMenu;
/*      */ import javax.swing.JMenuBar;
/*      */ import javax.swing.JMenuItem;
/*      */ import javax.swing.JOptionPane;
/*      */ import javax.swing.JPanel;
/*      */ import javax.swing.JPopupMenu;
/*      */ import javax.swing.JScrollPane;
/*      */ import javax.swing.JSplitPane;
/*      */ import javax.swing.JTextArea;
/*      */ import javax.swing.JTextPane;
/*      */ import javax.swing.JToggleButton;
/*      */ import javax.swing.JToolBar;
/*      */ import javax.swing.LayoutStyle.ComponentPlacement;
/*      */ import javax.swing.ListCellRenderer;
/*      */ import javax.swing.SwingUtilities;
/*      */ import javax.swing.UIManager;
/*      */ import javax.swing.event.InternalFrameEvent;
/*      */ import javax.swing.event.InternalFrameListener;
/*      */ import javax.swing.text.BadLocationException;
/*      */ import javax.swing.text.Document;
/*      */ import javax.swing.text.MutableAttributeSet;
/*      */ import javax.swing.text.Position;
/*      */ import javax.swing.text.SimpleAttributeSet;
/*      */ import javax.swing.text.StyleConstants;
/*      */ import javax.swing.text.StyledDocument;
/*      */ import javax.swing.text.TabSet;
/*      */ import javax.swing.text.TabStop;
/*      */ import org.python.core.PyObject;
/*      */ import org.python.util.InteractiveInterpreter;
/*      */ import org.python.util.PythonInterpreter;
/*      */ 
/*      */ public class Communicator extends JInternalFrame
/*      */   implements ActionListener, InternalFrameListener, FocusListener, ClipboardOwner
/*      */ {
/*  132 */   private static Rectangle windowSize = new Rectangle(0, 0, 740, 500);
/*      */   public Thread activeScript;
/*      */   public SerialPortCommunicator SC;
/*      */   private SSHCommunicator SSHC;
/*      */   public LibraryMethods LM;
/*      */   private TopLevelGUI TLGUI;
/*  143 */   private boolean oneScriptRunning = false;
/*      */   private boolean SSH;
/*  145 */   private boolean loggedin = false;
/*  146 */   private boolean passwordRdy = false;
/*  147 */   private boolean logBoolean = false;
/*  148 */   private boolean escaped = false;
/*  149 */   private boolean named = false;
/*  150 */   public boolean fullTimestamp = false;
/*  151 */   public boolean shortTimestamp = false;
/*  152 */   public boolean lineNumberStamp = false;
/*  153 */   private boolean scriptFromComboBox = false;
/*  154 */   private boolean connected = false;
/*      */ 
/*  156 */   private DefaultListModel scriptListModel = new DefaultListModel();
/*  157 */   private DefaultListModel commandHistory = new DefaultListModel();
/*  158 */   private DefaultComboBoxModel connectionDirectoryModel = new DefaultComboBoxModel();
/*  159 */   private DefaultComboBoxModel scriptFolderModel = new DefaultComboBoxModel();
/*  160 */   private TreeMap<Integer, String> ToolBarMapping = new TreeMap();
/*  161 */   private ArrayList<String> CommandsArrayList = new ArrayList();
/*  162 */   private ArrayList<File> loadedFiles = new ArrayList();
/*  163 */   private ArrayList<File> loadedFileDirectory = new ArrayList();
/*      */   private String libraryDirectory;
/*  165 */   private int currentCommandPointer = 0;
/*      */   private MouseAdapter ToolBarMouseAdapter;
/*      */   private int dataLogStartLine;
/*      */   private String logDirectory;
/*      */   private String logBaseName;
/*      */   private boolean logOutputType;
/*  171 */   private Date date = new Date();
/*  172 */   private int lineCounter = 0;
/*      */ 
/*  174 */   private int rightClickedCustomButton = 0;
/*  175 */   private String ConsoleBoxBuffer = "";
/*      */   public String username;
/*      */   public String password;
/*      */   public String portName;
/*  179 */   public String connectionName = "holder";
/*      */   private int windowNumber;
/*  181 */   private int offset = 25;
/*      */ 
/*  183 */   private String[] waitforCycle = new String[1000];
/*  184 */   private boolean updated = false;
/*  185 */   public int waitforIndex = 0;
/*  186 */   public int transmitted = 0;
/*  187 */   public boolean waitforSucceeded = false;
/*  188 */   public boolean record = false;
/*  189 */   public String recordingString = "";
/*      */   public JPanel MainPanel;
/*      */   public JSplitPane HorizontalSplitPanel;
/*      */   public JSplitPane VerticalSplitPanel;
/*      */   public JSplitPane CommandBoxSplitPanel;
/*      */   public SimpleScrollPane TopSSP;
/*      */   public SimpleScrollPane BottomSSP;
/*      */   public JLabel LoadedScriptsLabel;
/*      */   public JScrollPane LoadedScriptsPane;
/*      */   public JList LoadedScriptsList;
/*      */   public JComboBox ConnectionDirectoryComboBox;
/*      */   public JComboBox ScriptFolderComboBox;
/*      */   public JButton RunScriptButton;
/*      */   public JButton StopScriptButton;
/*      */   public JButton LogDataButton;
/*      */   public JButton EditScriptButton;
/*      */   public JButton ConfigScriptFolderButton;
/*      */   public JButton LoadScriptButton;
/*      */   public JButton RemoveScriptButton;
/*      */   public JButton ClearScreenButton;
/*      */   public JButton DisconnectButton;
/*      */   public JButton ConnectButton;
/*      */   public JButton ExitButton;
/*      */   public JButton BaudrateTool;
/*      */   public JPopupMenu BaudrateToolLeftClickMenu;
/*      */   public JMenuItem Baudrate75MenuItem;
/*      */   public JMenuItem Baudrate110MenuItem;
/*      */   public JMenuItem Baudrate134MenuItem;
/*      */   public JMenuItem Baudrate150MenuItem;
/*      */   public JMenuItem Baudrate300MenuItem;
/*      */   public JMenuItem Baudrate600MenuItem;
/*      */   public JMenuItem Baudrate1200MenuItem;
/*      */   public JMenuItem Baudrate1800MenuItem;
/*      */   public JMenuItem Baudrate2400MenuItem;
/*      */   public JMenuItem Baudrate4800MenuItem;
/*      */   public JMenuItem Baudrate5600MenuItem;
/*      */   public JMenuItem Baudrate7200MenuItem;
/*      */   public JMenuItem Baudrate9600MenuItem;
/*      */   public JMenuItem Baudrate14400MenuItem;
/*      */   public JMenuItem Baudrate19200MenuItem;
/*      */   public JMenuItem Baudrate28800MenuItem;
/*      */   public JMenuItem Baudrate38400MenuItem;
/*      */   public JMenuItem Baudrate57600MenuItem;
/*      */   public JMenuItem Baudrate115200MenuItem;
/*      */   public JMenuItem Baudrate128000MenuItem;
/*      */   public JButton DataBitsTool;
/*      */   public JPopupMenu DataBitsToolLeftClickMenu;
/*      */   public JMenuItem DataBits5MenuItem;
/*      */   public JMenuItem DataBits6MenuItem;
/*      */   public JMenuItem DataBits7MenuItem;
/*      */   public JMenuItem DataBits8MenuItem;
/*      */   public JButton StopBitsTool;
/*      */   public JPopupMenu StopBitsToolLeftClickMenu;
/*      */   public JMenuItem StopBits1MenuItem;
/*      */   public JMenuItem StopBits15MenuItem;
/*      */   public JMenuItem StopBits2MenuItem;
/*      */   public JButton ParityTool;
/*      */   public JPopupMenu ParityToolLeftClickMenu;
/*      */   public JMenuItem ParityNoneMenuItem;
/*      */   public JMenuItem ParityOddMenuItem;
/*      */   public JMenuItem ParityEvenMenuItem;
/*      */   public JMenuItem ParityMarkMenuItem;
/*      */   public JMenuItem ParitySpaceMenuItem;
/*      */   public JToggleButton RtsCtsToggle;
/*      */   public JToggleButton DTRToggle;
/*      */   public JButton CheckPropertiesButton;
/*      */   public JTextArea CBox;
/*      */   public JTextPane ConsoleBox;
/*      */   public JScrollPane ConsoleBoxScrollPane;
/*      */   public JTextArea CommandBox;
/*      */   public JScrollPane CommandBoxScrollPane;
/*      */   public JScrollPane CommandHistoryScrollPane;
/*      */   public JList CommandHistoryList;
/*      */   public JMenuBar MenuBar;
/*      */   public JMenu WindowMenu;
/*      */   public JMenuItem OpenEditorMenuItem;
/*      */   public JMenuItem SHButtonsMenuItem;
/*      */   public JMenuItem ExitMenuItem;
/*      */   public JMenu ViewMenu;
/*      */   public JMenuItem FullTimestampMenuItem;
/*      */   public JMenuItem ShortTimestampMenuItem;
/*      */   public JMenuItem LineNumberMenuItem;
/*      */   public JMenuItem TopToolBarMenuItem;
/*      */   public JMenuItem SidePanelMenuItem;
/*      */   public JMenuItem BottomToolBarMenuItem;
/*      */   public JMenuItem CommandBoxMenuItem;
/*      */   public JMenu CustomButtonsMenu;
/*      */   public JMenuItem RunScriptMenuItem;
/*      */   public JMenuItem LoadButtonConfigMenuItem;
/*      */   public JMenuItem SaveButtonConfigMenuItem;
/*      */   public JToolBar TopToolBar;
/*      */   public JToolBar CustomButtonsToolBar;
/*      */   public JToolBar PortOptionsToolBar;
/*      */   public JPopupMenu ConsoleBoxRightClickMenu;
/*      */   public JMenuItem ConsoleBoxCopyMenuItem;
/*      */   public JMenuItem ConsoleBoxPasteMenuItem;
/*      */   public JPopupMenu CommandBoxRightClickMenu;
/*      */   public JMenuItem CommandBoxCopyMenuItem;
/*      */   public JMenuItem CommandBoxPasteMenuItem;
/*      */   public JPopupMenu CustomButtonRightClickMenu;
/*      */   public JMenuItem CustomButtonChangeMenuItem;
/*      */   public JMenuItem CustomButtonDeleteMenuItem;
/*      */   public JPopupMenu CommandHistoryRightClickMenu;
/*      */   public JMenuItem CommandHistoryClearMenuItem;
/*      */   public JMenu ConsoleBoxBackgroundMenu;
/*      */   public JMenu ConsoleBoxForegroundMenu;
/*      */   public JMenu CommandBoxBackgroundMenu;
/*      */   public JMenu CommandBoxForegroundMenu;
/*      */   public JMenuItem[] COLORSMenuItem;
/* 3447 */   private static TreeMap<String, Color> COLORS = new TreeMap();
/*      */ 
/* 3464 */   private ListCellRenderer myRenderer = new ListCellRenderer()
/*      */   {
/*      */     public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
/*      */     {
/* 3470 */       String val = value.toString();
/* 3471 */       JLabel label = new JLabel(val);
/* 3472 */       if (isSelected)
/*      */       {
/* 3474 */         label.setBackground(list.getSelectionBackground());
/* 3475 */         label.setForeground(list.getSelectionForeground());
/*      */       }
/*      */       else
/*      */       {
/* 3479 */         label.setBackground((Color)Communicator.COLORS.get(val.toUpperCase()));
/* 3480 */         if (val.toUpperCase().equals("WHITE"))
/* 3481 */           label.setForeground((Color)Communicator.COLORS.get("BLACK"));
/*      */         else
/* 3483 */           label.setForeground((Color)Communicator.COLORS.get("WHITE"));
/*      */       }
/* 3485 */       label.setOpaque(true);
/* 3486 */       return label;
/*      */     }
/* 3464 */   };
/*      */ 
/*      */   public Communicator(SerialPortCommunicator SC, int windowNumber, TopLevelGUI TLGUI, boolean SSH, String portName, int multiplier, boolean fromCD)
/*      */   {
/*  204 */     super(SSH ? new StringBuilder().append(portName).append(" --- SSH Communicator").toString() : new StringBuilder().append(portName).append(" --- Serial Port Communicator").toString(), true, true, true, true);
/*      */ 
/*  210 */     init(SC, this.SSHC, windowNumber, TLGUI, SSH, portName, multiplier, fromCD);
/*      */   }
/*      */ 
/*      */   public Communicator(SSHCommunicator SSHC, int windowNumber, TopLevelGUI TLGUI, boolean SSH, String portName, int multiplier, boolean fromCD)
/*      */   {
/*  225 */     super(SSH ? new StringBuilder().append(portName).append(" --- SSH Communicator").toString() : new StringBuilder().append(portName).append(" --- Serial Port Communicator").toString(), true, true, true, true);
/*      */ 
/*  231 */     init(this.SC, SSHC, windowNumber, TLGUI, SSH, portName, multiplier, fromCD);
/*      */   }
/*      */ 
/*      */   public void init(SerialPortCommunicator SC, SSHCommunicator SSHC, int windowNumber, TopLevelGUI TLGUI, boolean SSH, String portName, int multiplier, boolean fromCD)
/*      */   {
/*      */     try
/*      */     {
/*  250 */       this.windowNumber = windowNumber;
/*  251 */       this.TLGUI = TLGUI;
/*  252 */       this.SSH = SSH;
/*  253 */       this.portName = portName;
/*  254 */       this.SC = SC;
/*  255 */       this.SSHC = SSHC;
/*  256 */       this.LM = this.LM;
/*      */ 
/*  258 */       for (int x = 0; x < this.waitforCycle.length; x++) {
/*  259 */         this.waitforCycle[x] = "";
/*      */       }
/*  261 */       if (fromCD)
/*      */       {
/*  263 */         TopLevelGUI.ActiveConnectionDirectory.put(((String[])TopLevelGUI.ConnectionDirectory.get(portName))[1], this.LM);
/*  264 */         File folder = new File(((String[])TopLevelGUI.ConnectionDirectory.get(portName))[12]);
/*  265 */         File[] temp = folder.listFiles();
/*  266 */         for (int x = 0; x < temp.length; x++)
/*      */         {
/*  268 */           if (temp[x].getName().contains(".py"))
/*  269 */             this.loadedFileDirectory.add(temp[x]);
/*      */         }
/*  271 */         this.portName = ((String[])TopLevelGUI.ConnectionDirectory.get(portName))[1];
/*  272 */         initComponents();
/*  273 */         this.ConnectionDirectoryComboBox.setSelectedItem(portName);
/*      */       }
/*      */       else
/*      */       {
/*  277 */         TopLevelGUI.ActiveConnectionDirectory.put(portName, this.LM);
/*      */ 
/*  279 */         this.logDirectory = "Logs/";
/*  280 */         this.logBaseName = "Data_Log_";
/*  281 */         this.logOutputType = true;
/*      */ 
/*  283 */         File folder = new File("Scripts/");
/*  284 */         File[] temp = folder.listFiles();
/*  285 */         for (int x = 0; x < temp.length; x++)
/*      */         {
/*  287 */           if (temp[x].getName().contains(".py")) {
/*  288 */             this.loadedFileDirectory.add(temp[x]);
/*      */           }
/*      */         }
/*  291 */         initComponents();
/*  292 */         SwingUtilities.invokeLater(new Runnable() {
/*      */           public void run() {
/*  294 */             Communicator.this.ConsoleBox.requestFocus();
/*      */           }
/*      */         });
/*  298 */         File file = new File("Options/LoadedFiles.txt");
/*  299 */         FileReader fis = null;
/*  300 */         BufferedReader dis = null;
/*      */ 
/*  302 */         fis = new FileReader(file);
/*      */ 
/*  304 */         dis = new BufferedReader(fis);
/*      */ 
/*  306 */         while (dis.ready())
/*      */         {
/*  308 */           String bob = dis.readLine();
/*  309 */           this.loadedFiles.add(new File(bob));
/*  310 */           this.scriptListModel.addElement(((File)this.loadedFiles.get(this.loadedFiles.size() - 1)).getName());
/*      */         }
/*      */ 
/*  315 */         fis.close();
/*  316 */         dis.close();
/*      */       }
/*      */ 
/*  319 */       setLocation(this.offset * multiplier, this.offset * multiplier);
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/*  323 */       e.printStackTrace();
/*      */     }
/*      */   }
/*      */ 
/*      */   private void initComponents()
/*      */   {
/*      */     try
/*      */     {
/*  333 */       this.MainPanel = new JPanel();
/*  334 */       this.ConsoleBoxScrollPane = new JScrollPane();
/*  335 */       this.CommandBoxScrollPane = new JScrollPane();
/*  336 */       this.ConsoleBox = new JTextPane();
/*  337 */       this.CommandBox = new JTextArea();
/*  338 */       this.ExitButton = new JButton();
/*  339 */       this.ConnectButton = new JButton();
/*  340 */       this.DisconnectButton = new JButton();
/*  341 */       this.ClearScreenButton = new JButton();
/*  342 */       this.EditScriptButton = new JButton();
/*  343 */       this.RemoveScriptButton = new JButton();
/*  344 */       this.LoadScriptButton = new JButton();
/*  345 */       this.LogDataButton = new JButton();
/*  346 */       this.StopScriptButton = new JButton();
/*  347 */       this.RunScriptButton = new JButton();
/*  348 */       this.LoadedScriptsPane = new JScrollPane();
/*  349 */       this.LoadedScriptsList = new JList(this.scriptListModel);
/*  350 */       this.CommandHistoryList = new JList(this.commandHistory);
/*  351 */       this.LoadedScriptsLabel = new JLabel();
/*  352 */       this.MenuBar = new JMenuBar();
/*  353 */       this.WindowMenu = new JMenu();
/*  354 */       this.RunScriptMenuItem = new JMenuItem();
/*  355 */       this.SHButtonsMenuItem = new JMenuItem();
/*  356 */       this.LoadButtonConfigMenuItem = new JMenuItem();
/*  357 */       this.SaveButtonConfigMenuItem = new JMenuItem();
/*  358 */       this.ExitMenuItem = new JMenuItem();
/*  359 */       this.ConfigScriptFolderButton = new JButton();
/*  360 */       this.TopToolBar = new JToolBar();
/*  361 */       this.CustomButtonsToolBar = new JToolBar();
/*  362 */       this.PortOptionsToolBar = new JToolBar();
/*  363 */       this.FullTimestampMenuItem = new JMenuItem();
/*  364 */       this.ShortTimestampMenuItem = new JMenuItem();
/*  365 */       this.LineNumberMenuItem = new JMenuItem();
/*  366 */       this.TopToolBarMenuItem = new JMenuItem();
/*  367 */       this.SidePanelMenuItem = new JMenuItem();
/*  368 */       this.BottomToolBarMenuItem = new JMenuItem();
/*  369 */       this.ConnectionDirectoryComboBox = new JComboBox();
/*  370 */       this.ScriptFolderComboBox = new JComboBox();
/*  371 */       this.ConsoleBoxRightClickMenu = new JPopupMenu();
/*  372 */       this.ConsoleBoxCopyMenuItem = new JMenuItem();
/*  373 */       this.ConsoleBoxPasteMenuItem = new JMenuItem();
/*  374 */       this.CommandBoxRightClickMenu = new JPopupMenu();
/*  375 */       this.CommandBoxCopyMenuItem = new JMenuItem();
/*  376 */       this.CommandBoxPasteMenuItem = new JMenuItem();
/*  377 */       this.CustomButtonRightClickMenu = new JPopupMenu();
/*  378 */       this.CustomButtonChangeMenuItem = new JMenuItem();
/*  379 */       this.CustomButtonDeleteMenuItem = new JMenuItem();
/*  380 */       this.ConsoleBoxBackgroundMenu = new JMenu("Background Color");
/*  381 */       this.ConsoleBoxForegroundMenu = new JMenu("Foreground Color");
/*  382 */       this.CommandBoxBackgroundMenu = new JMenu("Background Color");
/*  383 */       this.CommandBoxForegroundMenu = new JMenu("Foreground Color");
/*  384 */       this.CommandHistoryRightClickMenu = new JPopupMenu();
/*  385 */       this.CommandHistoryClearMenuItem = new JMenuItem("Clear");
/*  386 */       this.COLORSMenuItem = new JMenuItem[COLORS.size()];
/*  387 */       this.OpenEditorMenuItem = new JMenuItem();
/*  388 */       this.CommandBoxMenuItem = new JMenuItem();
/*  389 */       this.BaudrateTool = new JButton();
/*  390 */       this.DataBitsTool = new JButton();
/*  391 */       this.StopBitsTool = new JButton();
/*  392 */       this.ParityTool = new JButton();
/*  393 */       this.RtsCtsToggle = new JToggleButton();
/*  394 */       this.DTRToggle = new JToggleButton();
/*  395 */       this.CheckPropertiesButton = new JButton();
/*  396 */       this.CommandHistoryScrollPane = new JScrollPane();
/*      */ 
/*  399 */       setDefaultCloseOperation(2);
/*      */ 
/*  402 */       setFrameIcon(this.TLGUI.titleBarIcon);
/*  403 */       addInternalFrameListener(this);
/*      */ 
/*  410 */       for (int x = 0; x < this.COLORSMenuItem.length; x++)
/*      */       {
/*  412 */         Object[] keys = COLORS.keySet().toArray();
/*  413 */         this.COLORSMenuItem[x] = new JMenuItem(keys[x].toString());
/*      */ 
/*  415 */         this.COLORSMenuItem[x].setBackground((Color)COLORS.get(keys[x].toString()));
/*  416 */         if (keys[x].toString().equals("WHITE"))
/*  417 */           this.COLORSMenuItem[x].setForeground((Color)COLORS.get("BLACK"));
/*      */         else
/*  419 */           this.COLORSMenuItem[x].setForeground((Color)COLORS.get("WHITE"));
/*  420 */         this.COLORSMenuItem[x].setActionCommand(new StringBuilder().append("").append(30 + x).toString());
/*  421 */         this.COLORSMenuItem[x].addActionListener(this);
/*  422 */         this.ConsoleBoxBackgroundMenu.add(this.COLORSMenuItem[x]);
/*      */       }
/*      */ 
/*  425 */       for (int x = 0; x < this.COLORSMenuItem.length; x++)
/*      */       {
/*  427 */         Object[] keys = COLORS.keySet().toArray();
/*  428 */         this.COLORSMenuItem[x] = new JMenuItem(keys[x].toString());
/*      */ 
/*  430 */         this.COLORSMenuItem[x].setBackground((Color)COLORS.get(keys[x].toString()));
/*  431 */         if (keys[x].toString().equals("WHITE"))
/*  432 */           this.COLORSMenuItem[x].setForeground((Color)COLORS.get("BLACK"));
/*      */         else
/*  434 */           this.COLORSMenuItem[x].setForeground((Color)COLORS.get("WHITE"));
/*  435 */         this.COLORSMenuItem[x].setActionCommand(new StringBuilder().append("").append(41 + x).toString());
/*  436 */         this.COLORSMenuItem[x].addActionListener(this);
/*  437 */         this.ConsoleBoxForegroundMenu.add(this.COLORSMenuItem[x]);
/*      */       }
/*      */ 
/*  440 */       this.ConsoleBoxCopyMenuItem.setText("Copy");
/*  441 */       this.ConsoleBoxCopyMenuItem.setActionCommand("15");
/*  442 */       this.ConsoleBoxCopyMenuItem.addActionListener(this);
/*  443 */       this.ConsoleBoxRightClickMenu.add(this.ConsoleBoxCopyMenuItem);
/*      */ 
/*  445 */       this.ConsoleBoxPasteMenuItem.setText("Paste");
/*  446 */       this.ConsoleBoxPasteMenuItem.setActionCommand("16");
/*  447 */       this.ConsoleBoxPasteMenuItem.addActionListener(this);
/*  448 */       this.ConsoleBoxRightClickMenu.add(this.ConsoleBoxPasteMenuItem);
/*      */ 
/*  450 */       this.ConsoleBoxRightClickMenu.add(this.ConsoleBoxBackgroundMenu);
/*  451 */       this.ConsoleBoxRightClickMenu.add(this.ConsoleBoxForegroundMenu);
/*      */ 
/*  453 */       for (int x = 0; x < this.COLORSMenuItem.length; x++)
/*      */       {
/*  455 */         Object[] keys = COLORS.keySet().toArray();
/*  456 */         this.COLORSMenuItem[x] = new JMenuItem(keys[x].toString());
/*      */ 
/*  458 */         this.COLORSMenuItem[x].setBackground((Color)COLORS.get(keys[x].toString()));
/*  459 */         if (keys[x].toString().equals("WHITE"))
/*  460 */           this.COLORSMenuItem[x].setForeground((Color)COLORS.get("BLACK"));
/*      */         else
/*  462 */           this.COLORSMenuItem[x].setForeground((Color)COLORS.get("WHITE"));
/*  463 */         this.COLORSMenuItem[x].setActionCommand(new StringBuilder().append("").append(52 + x).toString());
/*  464 */         this.COLORSMenuItem[x].addActionListener(this);
/*  465 */         this.CommandBoxBackgroundMenu.add(this.COLORSMenuItem[x]);
/*      */       }
/*      */ 
/*  468 */       for (int x = 0; x < this.COLORSMenuItem.length; x++)
/*      */       {
/*  470 */         Object[] keys = COLORS.keySet().toArray();
/*  471 */         this.COLORSMenuItem[x] = new JMenuItem(keys[x].toString());
/*      */ 
/*  473 */         this.COLORSMenuItem[x].setBackground((Color)COLORS.get(keys[x].toString()));
/*  474 */         if (keys[x].toString().equals("WHITE"))
/*  475 */           this.COLORSMenuItem[x].setForeground((Color)COLORS.get("BLACK"));
/*      */         else
/*  477 */           this.COLORSMenuItem[x].setForeground((Color)COLORS.get("WHITE"));
/*  478 */         this.COLORSMenuItem[x].setActionCommand(new StringBuilder().append("").append(63 + x).toString());
/*  479 */         this.COLORSMenuItem[x].addActionListener(this);
/*  480 */         this.CommandBoxForegroundMenu.add(this.COLORSMenuItem[x]);
/*      */       }
/*      */ 
/*  483 */       this.CommandBoxCopyMenuItem.setText("Copy");
/*  484 */       this.CommandBoxCopyMenuItem.setActionCommand("17");
/*  485 */       this.CommandBoxCopyMenuItem.addActionListener(this);
/*  486 */       this.CommandBoxRightClickMenu.add(this.CommandBoxCopyMenuItem);
/*      */ 
/*  488 */       this.CommandBoxPasteMenuItem.setText("Paste");
/*  489 */       this.CommandBoxPasteMenuItem.setActionCommand("18");
/*  490 */       this.CommandBoxPasteMenuItem.addActionListener(this);
/*  491 */       this.CommandBoxRightClickMenu.add(this.CommandBoxPasteMenuItem);
/*      */ 
/*  493 */       this.CommandBoxRightClickMenu.add(this.CommandBoxBackgroundMenu);
/*  494 */       this.CommandBoxRightClickMenu.add(this.CommandBoxForegroundMenu);
/*      */ 
/*  496 */       this.CustomButtonChangeMenuItem.setText("Recreate");
/*  497 */       this.CustomButtonChangeMenuItem.setActionCommand("19");
/*  498 */       this.CustomButtonChangeMenuItem.addActionListener(this);
/*  499 */       this.CustomButtonRightClickMenu.add(this.CustomButtonChangeMenuItem);
/*      */ 
/*  501 */       this.CustomButtonDeleteMenuItem.setText("Delete");
/*  502 */       this.CustomButtonDeleteMenuItem.setActionCommand("20");
/*  503 */       this.CustomButtonDeleteMenuItem.addActionListener(this);
/*  504 */       this.CustomButtonRightClickMenu.add(this.CustomButtonDeleteMenuItem);
/*      */ 
/*  506 */       this.CommandHistoryClearMenuItem.setActionCommand("21");
/*  507 */       this.CommandHistoryClearMenuItem.addActionListener(this);
/*  508 */       this.CommandHistoryRightClickMenu.add(this.CommandHistoryClearMenuItem);
/*      */ 
/*  510 */       this.ConsoleBox.setBackground((Color)COLORS.get("BLUE"));
/*  511 */       this.ConsoleBox.setForeground((Color)COLORS.get("WHITE"));
/*  512 */       this.ConsoleBox.setFont(new Font("Courier", 0, 12));
/*  513 */       this.ConsoleBox.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 102), 3));
/*      */ 
/*  515 */       FontMetrics fm = this.ConsoleBox.getFontMetrics(this.ConsoleBox.getFont());
/*  516 */       int charWidth = fm.charWidth('w');
/*  517 */       int tabWidth = charWidth * 8;
/*  518 */       TabStop[] tabs = new TabStop[10];
/*  519 */       for (int j = 0; j < tabs.length; j++)
/*      */       {
/*  521 */         int tab = j + 1;
/*  522 */         tabs[j] = new TabStop(tab * tabWidth);
/*      */       }
/*  524 */       TabSet tabSet = new TabSet(tabs);
/*  525 */       SimpleAttributeSet attributes = new SimpleAttributeSet();
/*  526 */       StyleConstants.setTabSet(attributes, tabSet);
/*  527 */       int length = this.ConsoleBox.getDocument().getLength();
/*  528 */       this.ConsoleBox.getStyledDocument().setParagraphAttributes(0, length, attributes, false);
/*      */ 
/*  530 */       this.CommandHistoryList.addMouseListener(new MouseAdapter()
/*      */       {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  533 */           if (evt.isPopupTrigger())
/*      */           {
/*  535 */             int x = evt.getX();
/*  536 */             int y = evt.getY();
/*      */ 
/*  538 */             Communicator.this.CommandHistoryList.requestFocus(true);
/*  539 */             Communicator.this.CommandHistoryRightClickMenu.show(Communicator.this.CommandHistoryList, x, y);
/*  540 */             return;
/*      */           }
/*  542 */           if (evt.getClickCount() == 2)
/*      */           {
/*  544 */             Communicator.this.CommandBox.setText(Communicator.this.CommandHistoryList.getSelectedValue().toString());
/*  545 */             SwingUtilities.invokeLater(new Runnable() {
/*      */               public void run() {
/*  547 */                 Communicator.this.CommandBox.requestFocus();
/*      */               }
/*      */             });
/*      */           }
/*      */         }
/*      */       });
/*  558 */       this.CommandHistoryScrollPane.setViewportView(this.CommandHistoryList);
/*      */ 
/*  560 */       this.ConsoleBox.setCaretColor((Color)COLORS.get("WHITE"));
/*  561 */       this.ConsoleBox.setToolTipText("Console Box");
/*  562 */       this.ConsoleBox.addKeyListener(new KeyAdapter() {
/*      */         public void keyPressed(KeyEvent evt) {
/*  564 */           evt.consume();
/*      */         }
/*      */ 
/*      */         public void keyTyped(KeyEvent evt) {
/*  568 */           Communicator.this.ConsoleBoxKeyTyped(evt);
/*      */         }
/*      */       });
/*  571 */       this.ConsoleBox.addMouseListener(new MouseAdapter()
/*      */       {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  574 */           if (evt.isPopupTrigger())
/*      */           {
/*  576 */             int x = evt.getX();
/*  577 */             int y = evt.getY();
/*      */ 
/*  579 */             Communicator.this.ConsoleBox.requestFocus(true);
/*  580 */             Communicator.this.ConsoleBoxRightClickMenu.show(Communicator.this.ConsoleBox, x, y);
/*      */           }
/*      */         }
/*      */       });
/*  584 */       this.ConsoleBoxScrollPane.setViewportView(this.ConsoleBox);
/*      */ 
/*  586 */       this.CommandBox.setBackground((Color)COLORS.get("BLUE"));
/*  587 */       this.CommandBox.setForeground((Color)COLORS.get("WHITE"));
/*  588 */       this.CommandBox.setFont(new Font("Courier", 0, 12));
/*  589 */       this.CommandBox.setCaretColor((Color)COLORS.get("WHITE"));
/*  590 */       this.CommandBox.setToolTipText("Command Box == Commands:  Press Enter to transmit *** Scripts:  Enter is newline, Shift-Enter executes");
/*  591 */       this.CommandBox.addKeyListener(new KeyAdapter() {
/*  592 */         String text = "";
/*      */ 
/*      */         public void keyPressed(KeyEvent evt) {
/*  595 */           if ((evt.getKeyChar() == '\n') || (evt.getKeyChar() == '\n') || (evt.getKeyChar() == '\r'))
/*      */           {
/*  597 */             this.text = Communicator.this.CommandBox.getText();
/*  598 */             evt.consume();
/*      */           }
/*      */         }
/*      */ 
/*      */         public void keyTyped(KeyEvent evt) {
/*  603 */           char key = evt.getKeyChar();
/*  604 */           if ((key == '\n') || (key == '\n') || (key == '\r'))
/*      */           {
/*  606 */             this.text = Communicator.this.CommandBox.getText();
/*  607 */             evt.consume();
/*      */           }
/*  609 */           if ((Communicator.this.CommandBox.getText().split("\n").length != 0) && (Communicator.this.CommandBox.getText().split("\n")[0].toLowerCase().contains("Script".toLowerCase())))
/*      */           {
/*  611 */             if ((key == '\n') && (evt.isShiftDown()))
/*      */             {
/*      */               try
/*      */               {
/*  615 */                 File file = new File("TempScript.py");
/*  616 */                 file.delete();
/*  617 */                 File scriptFile = new File("TempScript.py");
/*  618 */                 scriptFile.createNewFile();
/*      */ 
/*  620 */                 FileWriter fstream = new FileWriter(scriptFile);
/*  621 */                 BufferedWriter out = new BufferedWriter(fstream);
/*      */ 
/*  623 */                 out.write(Communicator.this.CommandBox.getText().substring(6));
/*      */ 
/*  626 */                 out.close();
/*      */ 
/*  629 */                 if (!Communicator.this.CommandBox.getText().equals("")) {
/*  630 */                   Communicator.this.commandHistory.addElement(Communicator.this.CommandBox.getText());
/*      */                 }
/*  632 */                 Communicator.this.RunScriptEvent(scriptFile.getAbsolutePath().replace("\\", "/"));
/*      */               }
/*      */               catch (Exception e)
/*      */               {
/*      */               }
/*      */ 
/*      */             }
/*      */ 
/*  641 */             if ((key == '\n') && (!evt.isShiftDown()))
/*      */             {
/*  643 */               Communicator.this.CommandBox.insert("\n", Communicator.this.CommandBox.getCaretPosition());
/*      */             }
/*      */           }
/*      */           else
/*      */           {
/*  648 */             if ((key == '\n') && (evt.isShiftDown()))
/*      */             {
/*  650 */               if (!Communicator.this.CommandBox.getText().equals(""))
/*  651 */                 Communicator.this.commandHistory.addElement(Communicator.this.CommandBox.getText());
/*  652 */               Communicator.this.CommandBoxEnterPressed(evt);
/*      */             }
/*  654 */             if ((key == '\n') && (!evt.isShiftDown()))
/*      */             {
/*  656 */               Communicator.this.CommandBox.insert("\n", Communicator.this.CommandBox.getCaretPosition());
/*      */             }
/*      */           }
/*      */         }
/*      */       });
/*  662 */       this.CommandBox.addMouseListener(new MouseAdapter()
/*      */       {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  665 */           if (evt.isPopupTrigger())
/*      */           {
/*  667 */             int x = evt.getX();
/*  668 */             int y = evt.getY();
/*      */ 
/*  670 */             Communicator.this.CommandBox.requestFocus(true);
/*  671 */             Communicator.this.CommandBoxRightClickMenu.show(Communicator.this.CommandBox, x, y);
/*      */           }
/*      */         }
/*      */       });
/*  675 */       this.CommandBoxScrollPane.setViewportView(this.CommandBox);
/*      */ 
/*  677 */       this.ConnectionDirectoryComboBox.setModel(this.connectionDirectoryModel);
/*  678 */       this.ConnectionDirectoryComboBox.setPreferredSize(new Dimension(200, 50));
/*  679 */       this.ConnectionDirectoryComboBox.setMaximumSize(new Dimension(200, 50));
/*      */ 
/*  681 */       Object[] temp = TopLevelGUI.ConnectionDirectory.keySet().toArray();
/*  682 */       this.connectionDirectoryModel.addElement("Connection Directory: ");
/*  683 */       for (int x = 0; x < temp.length; x++)
/*      */       {
/*  685 */         this.connectionDirectoryModel.addElement((String)temp[x]);
/*      */       }
/*  687 */       this.ConnectionDirectoryComboBox.setActionCommand("0");
/*  688 */       this.ConnectionDirectoryComboBox.addActionListener(this);
/*  689 */       this.ConnectionDirectoryComboBox.setPreferredSize(new Dimension(200, 34));
/*  690 */       this.ConnectionDirectoryComboBox.setMaximumSize(new Dimension(200, 34));
/*      */ 
/*  692 */       this.TopToolBar.add(this.ConnectionDirectoryComboBox);
/*      */ 
/*  694 */       this.ScriptFolderComboBox.setModel(this.scriptFolderModel);
/*  695 */       if (this.loadedFileDirectory != null)
/*      */       {
/*  697 */         for (int x = 0; x < this.loadedFileDirectory.size(); x++)
/*      */         {
/*  699 */           if ((((File)this.loadedFileDirectory.get(x)).isFile()) && (((File)this.loadedFileDirectory.get(x)).getName().contains(".py")))
/*  700 */             this.scriptFolderModel.addElement(((File)this.loadedFileDirectory.get(x)).getName());
/*      */         }
/*      */       }
/*  703 */       this.ScriptFolderComboBox.setActionCommand("1");
/*  704 */       this.ScriptFolderComboBox.addActionListener(this);
/*  705 */       this.ScriptFolderComboBox.addFocusListener(this);
/*  706 */       this.ScriptFolderComboBox.setPreferredSize(new Dimension(200, 34));
/*  707 */       this.ScriptFolderComboBox.setMaximumSize(new Dimension(200, 34));
/*  708 */       this.ScriptFolderComboBox.setBorder(BorderFactory.createLineBorder(UIManager.getColor("ComboBox.buttonShadow"), 1));
/*      */ 
/*  710 */       this.TopToolBar.add(this.ScriptFolderComboBox);
/*      */ 
/*  714 */       this.RunScriptButton.setIcon(new ImageIcon("Images/Aqua-Play-icon_Small.png"));
/*  715 */       this.RunScriptButton.setToolTipText("Run Script");
/*      */ 
/*  717 */       this.RunScriptButton.setPreferredSize(new Dimension(34, 34));
/*  718 */       this.RunScriptButton.setMaximumSize(new Dimension(34, 34));
/*  719 */       this.RunScriptButton.addMouseListener(new MouseAdapter() {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  721 */           Communicator.this.RunScriptEvent("");
/*      */         }
/*      */       });
/*  724 */       this.TopToolBar.add(this.RunScriptButton);
/*      */ 
/*  728 */       this.StopScriptButton.setIcon(new ImageIcon("Images/Aqua-Stop-icon_Small.png"));
/*  729 */       this.StopScriptButton.setToolTipText("Stop Script");
/*      */ 
/*  731 */       this.StopScriptButton.setPreferredSize(new Dimension(34, 34));
/*  732 */       this.StopScriptButton.setMaximumSize(new Dimension(34, 34));
/*  733 */       this.StopScriptButton.addMouseListener(new MouseAdapter() {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  735 */           Communicator.this.StopScriptButtonmouseReleased();
/*      */         }
/*      */       });
/*  738 */       this.TopToolBar.add(this.StopScriptButton);
/*      */ 
/*  742 */       this.LogDataButton.setIcon(new ImageIcon("Images/Apps_Small.png"));
/*  743 */       this.LogDataButton.setToolTipText("Log Data (Capture");
/*      */ 
/*  745 */       this.LogDataButton.setPreferredSize(new Dimension(34, 34));
/*  746 */       this.LogDataButton.setMaximumSize(new Dimension(34, 34));
/*  747 */       this.LogDataButton.addMouseListener(new MouseAdapter() {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  749 */           Communicator.this.LogDataButtonMouseReleased();
/*      */         }
/*      */       });
/*  752 */       this.TopToolBar.add(this.LogDataButton);
/*      */ 
/*  756 */       this.EditScriptButton.setIcon(new ImageIcon("Images/Customize_Small.png"));
/*  757 */       this.EditScriptButton.setToolTipText("Edit Script");
/*      */ 
/*  759 */       this.EditScriptButton.setPreferredSize(new Dimension(34, 34));
/*  760 */       this.EditScriptButton.setMaximumSize(new Dimension(34, 34));
/*  761 */       this.EditScriptButton.addMouseListener(new MouseAdapter() {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  763 */           Communicator.this.createEditorWindow();
/*      */         }
/*      */       });
/*  766 */       this.TopToolBar.add(this.EditScriptButton);
/*      */ 
/*  770 */       this.ConfigScriptFolderButton.setIcon(new ImageIcon("Images/DeveloperFolder_Small.png"));
/*  771 */       this.ConfigScriptFolderButton.setToolTipText("Change Script Folder");
/*      */ 
/*  773 */       this.ConfigScriptFolderButton.setPreferredSize(new Dimension(34, 34));
/*  774 */       this.ConfigScriptFolderButton.setMaximumSize(new Dimension(34, 34));
/*  775 */       this.ConfigScriptFolderButton.addMouseListener(new MouseAdapter() {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  777 */           Communicator.this.ConfigScriptFolderEvent();
/*      */         }
/*      */       });
/*  780 */       this.TopToolBar.add(this.ConfigScriptFolderButton);
/*      */ 
/*  784 */       this.ClearScreenButton.setIcon(new ImageIcon("Images/Computer_Small.png"));
/*  785 */       this.ClearScreenButton.setToolTipText("Clear Screen");
/*      */ 
/*  787 */       this.ClearScreenButton.setPreferredSize(new Dimension(34, 34));
/*  788 */       this.ClearScreenButton.setMaximumSize(new Dimension(34, 34));
/*  789 */       this.ClearScreenButton.addMouseListener(new MouseAdapter() {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  791 */           Communicator.this.ClearScreenButtonmouseReleased();
/*      */         }
/*      */       });
/*  794 */       this.TopToolBar.add(this.ClearScreenButton);
/*      */ 
/*  798 */       this.ConnectButton.setIcon(new ImageIcon("Images/Connect_Small.png"));
/*  799 */       this.ConnectButton.setToolTipText("Connect");
/*      */ 
/*  801 */       this.ConnectButton.setPreferredSize(new Dimension(34, 34));
/*  802 */       this.ConnectButton.setMaximumSize(new Dimension(34, 34));
/*  803 */       this.ConnectButton.setVisible(false);
/*  804 */       this.ConnectButton.addMouseListener(new MouseAdapter() {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  806 */           Communicator.this.ConnectButtonmouseReleased();
/*      */         }
/*      */       });
/*  809 */       this.TopToolBar.add(this.ConnectButton);
/*      */ 
/*  813 */       this.DisconnectButton.setIcon(new ImageIcon("Images/Disconnected_Small.png"));
/*  814 */       this.DisconnectButton.setToolTipText("Disconnect");
/*      */ 
/*  816 */       this.DisconnectButton.setPreferredSize(new Dimension(34, 34));
/*  817 */       this.DisconnectButton.setMaximumSize(new Dimension(34, 34));
/*  818 */       this.DisconnectButton.addMouseListener(new MouseAdapter() {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  820 */           Communicator.this.DisconnectButtonmouseReleased();
/*      */         }
/*      */       });
/*  823 */       this.TopToolBar.add(this.DisconnectButton);
/*      */ 
/*  827 */       this.ExitButton.setIcon(new ImageIcon("Images/Aqua-Shutdown-icon_Small.png"));
/*  828 */       this.ExitButton.setToolTipText("Exit");
/*      */ 
/*  830 */       this.ExitButton.setPreferredSize(new Dimension(34, 34));
/*  831 */       this.ExitButton.setMaximumSize(new Dimension(34, 34));
/*  832 */       this.ExitButton.addMouseListener(new MouseAdapter() {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  834 */           Communicator.this.ExitEvent();
/*      */         }
/*      */       });
/*  839 */       this.TopToolBar.addSeparator(new Dimension(10, 34));
/*      */ 
/*  843 */       this.LoadScriptButton.setIcon(new ImageIcon("Images/Text_Small.png"));
/*  844 */       this.LoadScriptButton.setToolTipText("Load Script");
/*      */ 
/*  846 */       this.LoadScriptButton.setPreferredSize(new Dimension(34, 34));
/*  847 */       this.LoadScriptButton.setMaximumSize(new Dimension(34, 34));
/*  848 */       this.LoadScriptButton.addMouseListener(new MouseAdapter() {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  850 */           Communicator.this.LoadScriptEvent();
/*      */         }
/*      */       });
/*  853 */       this.TopToolBar.add(this.LoadScriptButton);
/*      */ 
/*  857 */       this.RemoveScriptButton.setIcon(new ImageIcon("Images/Document_Small.png"));
/*  858 */       this.RemoveScriptButton.setToolTipText("Remove Script");
/*      */ 
/*  860 */       this.RemoveScriptButton.setPreferredSize(new Dimension(34, 34));
/*  861 */       this.RemoveScriptButton.setMaximumSize(new Dimension(34, 34));
/*  862 */       this.RemoveScriptButton.addMouseListener(new MouseAdapter() {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  864 */           Communicator.this.RemoveScriptButtonmouseReleased();
/*      */         }
/*      */       });
/*  867 */       this.TopToolBar.add(this.RemoveScriptButton);
/*      */ 
/*  873 */       this.LoadedScriptsList.setBorder(BorderFactory.createEtchedBorder(new Color(231, 231, 78), null));
/*  874 */       this.LoadedScriptsList.addFocusListener(this);
/*      */ 
/*  877 */       this.LoadedScriptsPane.setViewportView(this.LoadedScriptsList);
/*  878 */       this.LoadedScriptsPane.setBorder(BorderFactory.createLineBorder(new Color(0, 200, 0), 2));
/*      */ 
/*  882 */       this.LoadedScriptsLabel.setHorizontalAlignment(0);
/*  883 */       this.LoadedScriptsLabel.setText("Loaded Scripts");
/*  884 */       this.LoadedScriptsLabel.setBorder(BorderFactory.createEtchedBorder(new Color(227, 227, 74), null));
/*  885 */       this.LoadedScriptsLabel.setOpaque(true);
/*      */ 
/*  887 */       JPanel jtemp2 = new JPanel();
/*      */ 
/*  889 */       GroupLayout jtemp2Layout = new GroupLayout(jtemp2);
/*  890 */       jtemp2.setLayout(jtemp2Layout);
/*  891 */       jtemp2Layout.setHorizontalGroup(jtemp2Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(this.LoadedScriptsLabel, 0, 130, 32767).addComponent(this.LoadedScriptsPane, 0, 125, 32767));
/*      */ 
/*  896 */       jtemp2Layout.setVerticalGroup(jtemp2Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(jtemp2Layout.createSequentialGroup().addComponent(this.LoadedScriptsLabel, -2, -1, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.LoadedScriptsPane, 0, 225, 32767)));
/*      */ 
/*  904 */       this.CommandBoxSplitPanel = new JSplitPane(1, this.CommandBoxScrollPane, this.CommandHistoryScrollPane);
/*  905 */       this.CommandBoxSplitPanel.setOneTouchExpandable(true);
/*  906 */       this.CommandBoxSplitPanel.setDividerLocation(0.8D);
/*  907 */       this.CommandBoxSplitPanel.setResizeWeight(1.0D);
/*  908 */       this.CommandBoxSplitPanel.setContinuousLayout(true);
/*      */ 
/*  910 */       this.VerticalSplitPanel = new JSplitPane(0, this.ConsoleBoxScrollPane, this.CommandBoxSplitPanel);
/*  911 */       this.VerticalSplitPanel.setOneTouchExpandable(true);
/*  912 */       this.VerticalSplitPanel.setDividerLocation(0.7D);
/*  913 */       this.VerticalSplitPanel.setResizeWeight(1.0D);
/*  914 */       this.VerticalSplitPanel.setContinuousLayout(true);
/*      */ 
/*  916 */       this.HorizontalSplitPanel = new JSplitPane(1, this.VerticalSplitPanel, jtemp2);
/*  917 */       this.HorizontalSplitPanel.setOneTouchExpandable(true);
/*  918 */       this.HorizontalSplitPanel.setDividerLocation(0.8D);
/*  919 */       this.HorizontalSplitPanel.setResizeWeight(1.0D);
/*  920 */       this.HorizontalSplitPanel.setContinuousLayout(true);
/*      */ 
/*  925 */       this.BaudrateTool.setText("Baudrate");
/*  926 */       this.BaudrateTool.setPreferredSize(new Dimension(75, 20));
/*  927 */       this.BaudrateTool.setMaximumSize(new Dimension(75, 20));
/*  928 */       BuildBaudrateMenu();
/*      */ 
/*  931 */       this.BaudrateTool.addMouseListener(new MouseAdapter()
/*      */       {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  934 */           if (!evt.isPopupTrigger())
/*      */           {
/*  936 */             int x = evt.getX();
/*  937 */             int y = evt.getY();
/*      */ 
/*  939 */             Communicator.this.BaudrateTool.requestFocus(true);
/*  940 */             Communicator.this.BaudrateToolLeftClickMenu.show(Communicator.this.BaudrateTool, x, y - 270);
/*      */           }
/*      */         }
/*      */       });
/*  944 */       this.PortOptionsToolBar.add(this.BaudrateTool);
/*      */ 
/*  946 */       this.DataBitsTool.setText("Data Bits");
/*  947 */       this.DataBitsTool.setPreferredSize(new Dimension(75, 20));
/*  948 */       this.DataBitsTool.setMaximumSize(new Dimension(75, 20));
/*  949 */       BuildDataBitsMenu();
/*  950 */       this.DataBitsTool.addMouseListener(new MouseAdapter()
/*      */       {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  953 */           if (!evt.isPopupTrigger())
/*      */           {
/*  955 */             int x = evt.getX();
/*  956 */             int y = evt.getY();
/*      */ 
/*  958 */             Communicator.this.DataBitsTool.requestFocus(true);
/*  959 */             Communicator.this.DataBitsToolLeftClickMenu.show(Communicator.this.DataBitsTool, x, y - 100);
/*      */           }
/*      */         }
/*      */       });
/*  963 */       this.PortOptionsToolBar.add(this.DataBitsTool);
/*      */ 
/*  965 */       this.StopBitsTool.setText("Stop Bits");
/*  966 */       this.StopBitsTool.setPreferredSize(new Dimension(75, 20));
/*  967 */       this.StopBitsTool.setMaximumSize(new Dimension(75, 20));
/*  968 */       BuildStopBitsMenu();
/*  969 */       this.StopBitsTool.addMouseListener(new MouseAdapter()
/*      */       {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  972 */           if (!evt.isPopupTrigger())
/*      */           {
/*  974 */             int x = evt.getX();
/*  975 */             int y = evt.getY();
/*      */ 
/*  977 */             Communicator.this.StopBitsTool.requestFocus(true);
/*  978 */             Communicator.this.StopBitsToolLeftClickMenu.show(Communicator.this.StopBitsTool, x, y - 75);
/*      */           }
/*      */         }
/*      */       });
/*  982 */       this.PortOptionsToolBar.add(this.StopBitsTool);
/*      */ 
/*  984 */       this.ParityTool.setText("Parity");
/*  985 */       this.ParityTool.setPreferredSize(new Dimension(75, 20));
/*  986 */       this.ParityTool.setMaximumSize(new Dimension(75, 20));
/*  987 */       BuildParityMenu();
/*  988 */       this.ParityTool.addMouseListener(new MouseAdapter()
/*      */       {
/*      */         public void mouseReleased(MouseEvent evt) {
/*  991 */           if (!evt.isPopupTrigger())
/*      */           {
/*  993 */             int x = evt.getX();
/*  994 */             int y = evt.getY();
/*      */ 
/*  996 */             Communicator.this.ParityTool.requestFocus(true);
/*  997 */             Communicator.this.ParityToolLeftClickMenu.show(Communicator.this.ParityTool, x, y - 125);
/*      */           }
/*      */         }
/*      */       });
/* 1001 */       this.PortOptionsToolBar.add(this.ParityTool);
/*      */ 
/* 1003 */       this.RtsCtsToggle.setSelected(false);
/* 1004 */       this.RtsCtsToggle.setText("Request To Send");
/* 1005 */       this.RtsCtsToggle.setPreferredSize(new Dimension(125, 20));
/* 1006 */       this.RtsCtsToggle.setMaximumSize(new Dimension(125, 20));
/* 1007 */       this.RtsCtsToggle.setActionCommand("132");
/* 1008 */       this.RtsCtsToggle.addActionListener(this);
/* 1009 */       this.PortOptionsToolBar.add(this.RtsCtsToggle);
/*      */ 
/* 1011 */       this.DTRToggle.setSelected(false);
/* 1012 */       this.DTRToggle.setText("Data Terminal Ready");
/* 1013 */       this.DTRToggle.setPreferredSize(new Dimension(125, 20));
/* 1014 */       this.DTRToggle.setMaximumSize(new Dimension(125, 20));
/* 1015 */       this.DTRToggle.setActionCommand("133");
/* 1016 */       this.DTRToggle.addActionListener(this);
/* 1017 */       this.PortOptionsToolBar.add(this.DTRToggle);
/*      */ 
/* 1019 */       this.CheckPropertiesButton.setText("Print Port Settings");
/* 1020 */       this.CheckPropertiesButton.setPreferredSize(new Dimension(125, 20));
/* 1021 */       this.CheckPropertiesButton.setMaximumSize(new Dimension(125, 20));
/* 1022 */       this.CheckPropertiesButton.setActionCommand("134");
/* 1023 */       this.CheckPropertiesButton.addActionListener(this);
/* 1024 */       this.PortOptionsToolBar.add(this.CheckPropertiesButton);
/*      */ 
/* 1031 */       this.WindowMenu.setText("Window");
/*      */ 
/* 1033 */       this.OpenEditorMenuItem.setText("Edit Script/Open Editor");
/* 1034 */       this.OpenEditorMenuItem.setActionCommand("4");
/* 1035 */       this.OpenEditorMenuItem.addActionListener(this);
/* 1036 */       this.WindowMenu.add(this.OpenEditorMenuItem);
/*      */ 
/* 1038 */       this.ExitMenuItem.setText("Exit");
/*      */ 
/* 1041 */       this.ExitMenuItem.setActionCommand("7");
/* 1042 */       this.ExitMenuItem.addActionListener(this);
/* 1043 */       this.WindowMenu.add(this.ExitMenuItem);
/*      */ 
/* 1045 */       this.MenuBar.add(this.WindowMenu);
/*      */ 
/* 1047 */       this.ViewMenu = new JMenu();
/*      */ 
/* 1050 */       this.ViewMenu.setText("View");
/*      */ 
/* 1052 */       this.FullTimestampMenuItem.setText("Show Long Timestamps");
/*      */ 
/* 1055 */       this.FullTimestampMenuItem.setActionCommand("8");
/* 1056 */       this.FullTimestampMenuItem.addActionListener(this);
/* 1057 */       this.ViewMenu.add(this.FullTimestampMenuItem);
/*      */ 
/* 1059 */       this.ShortTimestampMenuItem.setText("Show Short Timestamps");
/*      */ 
/* 1062 */       this.ShortTimestampMenuItem.setActionCommand("5");
/* 1063 */       this.ShortTimestampMenuItem.addActionListener(this);
/* 1064 */       this.ViewMenu.add(this.ShortTimestampMenuItem);
/*      */ 
/* 1066 */       this.LineNumberMenuItem.setText("Show Line Numbers");
/*      */ 
/* 1069 */       this.LineNumberMenuItem.setActionCommand("2");
/* 1070 */       this.LineNumberMenuItem.addActionListener(this);
/* 1071 */       this.ViewMenu.add(this.LineNumberMenuItem);
/*      */ 
/* 1073 */       this.SHButtonsMenuItem.setText("Show/Hide All");
/*      */ 
/* 1076 */       this.SHButtonsMenuItem.setActionCommand("6");
/* 1077 */       this.SHButtonsMenuItem.addActionListener(this);
/* 1078 */       this.ViewMenu.add(this.SHButtonsMenuItem);
/*      */ 
/* 1080 */       this.TopToolBarMenuItem.setText("Hide Top Tool Bar");
/*      */ 
/* 1083 */       this.TopToolBarMenuItem.setActionCommand("9");
/* 1084 */       this.TopToolBarMenuItem.addActionListener(this);
/* 1085 */       this.ViewMenu.add(this.TopToolBarMenuItem);
/*      */ 
/* 1087 */       this.SidePanelMenuItem.setText("Hide Side Panel");
/*      */ 
/* 1090 */       this.SidePanelMenuItem.setActionCommand("10");
/* 1091 */       this.SidePanelMenuItem.addActionListener(this);
/* 1092 */       this.ViewMenu.add(this.SidePanelMenuItem);
/*      */ 
/* 1094 */       this.BottomToolBarMenuItem.setText("Hide Bottom Tool Bar");
/*      */ 
/* 1097 */       this.BottomToolBarMenuItem.setActionCommand("11");
/* 1098 */       this.BottomToolBarMenuItem.addActionListener(this);
/* 1099 */       this.ViewMenu.add(this.BottomToolBarMenuItem);
/*      */ 
/* 1101 */       this.CommandBoxMenuItem.setText("Hide Command Box");
/*      */ 
/* 1104 */       this.CommandBoxMenuItem.setActionCommand("3");
/* 1105 */       this.CommandBoxMenuItem.addActionListener(this);
/* 1106 */       this.ViewMenu.add(this.CommandBoxMenuItem);
/*      */ 
/* 1108 */       this.MenuBar.add(this.ViewMenu);
/*      */ 
/* 1110 */       this.CustomButtonsMenu = new JMenu();
/*      */ 
/* 1113 */       this.CustomButtonsMenu.setText("Custom Buttons");
/*      */ 
/* 1115 */       this.RunScriptMenuItem.setText("Add Custom Button");
/*      */ 
/* 1118 */       this.RunScriptMenuItem.setActionCommand("12");
/* 1119 */       this.RunScriptMenuItem.addActionListener(this);
/* 1120 */       this.CustomButtonsMenu.add(this.RunScriptMenuItem);
/*      */ 
/* 1122 */       this.LoadButtonConfigMenuItem.setText("Load Button Config");
/*      */ 
/* 1125 */       this.LoadButtonConfigMenuItem.setActionCommand("13");
/* 1126 */       this.LoadButtonConfigMenuItem.addActionListener(this);
/* 1127 */       this.CustomButtonsMenu.add(this.LoadButtonConfigMenuItem);
/*      */ 
/* 1129 */       this.SaveButtonConfigMenuItem.setText("Save Button Config");
/*      */ 
/* 1132 */       this.SaveButtonConfigMenuItem.setActionCommand("14");
/* 1133 */       this.SaveButtonConfigMenuItem.addActionListener(this);
/* 1134 */       this.CustomButtonsMenu.add(this.SaveButtonConfigMenuItem);
/*      */ 
/* 1136 */       this.MenuBar.add(this.CustomButtonsMenu);
/*      */ 
/* 1138 */       setJMenuBar(this.MenuBar);
/*      */ 
/* 1142 */       this.TopToolBar.setFloatable(false);
/* 1143 */       this.TopToolBar.setVisible(true);
/*      */ 
/* 1147 */       this.CustomButtonsToolBar.setFloatable(false);
/* 1148 */       this.CustomButtonsToolBar.setVisible(true);
/*      */ 
/* 1150 */       this.TopSSP = new SimpleScrollPane(this.TopToolBar, 21, 30);
/* 1151 */       this.BottomSSP = new SimpleScrollPane(this.CustomButtonsToolBar, 21, 30);
/*      */ 
/* 1154 */       GroupLayout MainPanelLayout = new GroupLayout(this.MainPanel);
/* 1155 */       this.MainPanel.setLayout(MainPanelLayout);
/* 1156 */       MainPanelLayout.setHorizontalGroup(MainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(MainPanelLayout.createSequentialGroup().addGap(3, 3, 3).addComponent(this.HorizontalSplitPanel, 0, 740, 32767)).addComponent(this.BottomSSP, 0, 740, 32767).addComponent(this.PortOptionsToolBar, 0, 740, 32767).addComponent(this.TopSSP, 0, 740, 32767));
/*      */ 
/* 1165 */       MainPanelLayout.setVerticalGroup(MainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(MainPanelLayout.createSequentialGroup().addComponent(this.TopSSP, 40, 40, -2).addGap(3, 3, 3).addComponent(this.HorizontalSplitPanel, 0, 400, 32767).addGap(3, 3, 3).addComponent(this.BottomSSP, 30, 30, -2).addComponent(this.PortOptionsToolBar, 22, 22, -2)));
/*      */ 
/* 1176 */       GroupLayout layout = new GroupLayout(getContentPane());
/* 1177 */       getContentPane().setLayout(layout);
/* 1178 */       layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(this.MainPanel, 540, 740, 32767));
/*      */ 
/* 1182 */       layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(this.MainPanel, 245, -1, 32767));
/*      */ 
/* 1187 */       setMinimumSize(new Dimension(550, 300));
/*      */ 
/* 1189 */       updateColorScheme();
/*      */ 
/* 1191 */       pack();
/* 1192 */       moveToFront();
/*      */ 
/* 1198 */       reshape((int)windowSize.getX(), (int)windowSize.getY(), (int)windowSize.getWidth(), (int)windowSize.getHeight());
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/* 1204 */       e.printStackTrace();
/*      */     }
/*      */   }
/*      */ 
/*      */   public void captureWaitfor(String start, String end, int timeout, int lineout, LibraryMethods LibMet) {
/* 1209 */     this.waitforSucceeded = false;
/* 1210 */     boolean matched = false;
/* 1211 */     long prevTime = System.currentTimeMillis();
/* 1212 */     this.record = true;
/*      */     try
/*      */     {
/* 1219 */       while ((timeout > 0) && ((LibMet == null) || (LibMet.stopped)) && (!matched))
/*      */       {
/* 1221 */         System.out.println(new StringBuilder().append("TIMEOUT LEFT ").append(timeout).toString());
/* 1222 */         timeout = (int)(timeout - (System.currentTimeMillis() - prevTime));
/* 1223 */         prevTime = System.currentTimeMillis();
/*      */ 
/* 1225 */         this.updated = false;
/* 1226 */         for (int x = this.transmitted; x <= this.waitforIndex; x++)
/*      */         {
/* 1229 */           if (this.waitforCycle[x].toLowerCase().contains(end.toLowerCase()))
/*      */           {
/* 1231 */             System.out.println(new StringBuilder().append("MATCH!!!END:").append(this.waitforCycle[x]).toString());
/* 1232 */             this.waitforSucceeded = true;
/* 1233 */             matched = true;
/* 1234 */             this.waitforIndex = x;
/* 1235 */             this.record = false;
/* 1236 */             break;
/*      */           }
/*      */ 
/* 1242 */           if (!this.waitforCycle[x].toLowerCase().contains(start.toLowerCase()))
/*      */             continue;
/* 1244 */           System.out.println(new StringBuilder().append("MATCH!!!START:").append(this.waitforCycle[x]).toString());
/*      */         }
/*      */ 
/* 1256 */         Thread.yield();
/*      */       }
/*      */     } catch (Exception e) {
/*      */     }
/*      */   }
/*      */ 
/*      */   public void waitfor(String item, int timeout, int lineout, LibraryMethods LibMet) {
/* 1263 */     this.waitforSucceeded = false;
/* 1264 */     boolean matched = false;
/* 1265 */     long prevTime = System.currentTimeMillis();
/*      */     try
/*      */     {
/* 1272 */       while ((timeout > 0) && ((LibMet == null) || (LibMet.stopped)) && (!matched))
/*      */       {
/* 1274 */         System.out.println(new StringBuilder().append("TIMEOUT LEFT ").append(timeout).toString());
/* 1275 */         timeout = (int)(timeout - (System.currentTimeMillis() - prevTime));
/* 1276 */         prevTime = System.currentTimeMillis();
/*      */ 
/* 1280 */         this.updated = false;
/*      */ 
/* 1285 */         for (int x = this.transmitted; x <= this.waitforIndex; x++)
/*      */         {
/* 1288 */           if (!this.waitforCycle[x].toLowerCase().contains(item.toLowerCase()))
/*      */             continue;
/* 1290 */           System.out.println(new StringBuilder().append("MATCH!!!").append(this.waitforCycle[x]).toString());
/* 1291 */           this.waitforSucceeded = true;
/* 1292 */           matched = true;
/* 1293 */           this.waitforIndex = x;
/* 1294 */           break;
/*      */         }
/*      */ 
/* 1310 */         Thread.yield();
/*      */       }
/*      */     } catch (Exception e) {
/*      */     }
/*      */   }
/*      */ 
/*      */   public String lineOptions() {
/* 1317 */     ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
/*      */ 
/* 1319 */     StyledDocument doc = this.ConsoleBox.getStyledDocument();
/* 1320 */     String line = "";
/* 1321 */     if (doc != null)
/*      */     {
/* 1323 */       this.date.setTime(System.currentTimeMillis());
/* 1324 */       if (this.fullTimestamp)
/*      */       {
/* 1326 */         SimpleDateFormat custDateFormat = new SimpleDateFormat("EEE MMM-dd HH:mm:ss.SSS zzz yyyy");
/* 1327 */         line = new StringBuilder().append(line).append("[").append(custDateFormat.format(this.date)).append("] ").toString();
/*      */       }
/* 1329 */       if (this.shortTimestamp)
/*      */       {
/* 1331 */         SimpleDateFormat custDateFormat = new SimpleDateFormat("MMM-dd-yy HH:mm:ss");
/* 1332 */         line = new StringBuilder().append(line).append("[").append(custDateFormat.format(this.date)).append("] ").toString();
/*      */       }
/* 1334 */       if (this.lineNumberStamp)
/*      */       {
/* 1336 */         line = new StringBuilder().append(line).append(this.lineCounter).append(" ").toString();
/*      */       }
/*      */ 
/* 1341 */       this.lineCounter += 1;
/*      */     }
/*      */ 
/* 1347 */     return line;
/*      */   }
/*      */ 
/*      */   public void append(String str) {
/* 1351 */     StyledDocument doc = this.ConsoleBox.getStyledDocument();
/*      */ 
/* 1353 */     if (doc != null)
/*      */     {
/*      */       try
/*      */       {
/* 1358 */         str = str.replace("\r", "");
/* 1359 */         str = str.replace("\n", new StringBuilder().append("\n").append(lineOptions()).toString());
/*      */ 
/* 1361 */         if (this.record) {
/* 1362 */           this.recordingString = new StringBuilder().append(this.recordingString).append(str).toString();
/*      */         }
/* 1364 */         if (doc.getLength() > 50000) {
/* 1365 */           doc.remove(doc.getStartPosition().getOffset(), 1000);
/*      */         }
/* 1367 */         doc.insertString(doc.getLength(), str, null);
/* 1368 */         String[] s = str.replace("\n", "\n ").split("\n");
/* 1369 */         if (s.length == 1)
/*      */         {
/*      */           int tmp169_166 = this.waitforIndex;
/*      */           String[] tmp169_162 = this.waitforCycle; tmp169_162[tmp169_166] = new StringBuilder().append(tmp169_162[tmp169_166]).append(s[0]).toString();
/*      */         }
/* 1373 */         else if (s.length > 1)
/*      */         {
/*      */           int tmp208_205 = this.waitforIndex;
/*      */           String[] tmp208_201 = this.waitforCycle; tmp208_201[tmp208_205] = new StringBuilder().append(tmp208_201[tmp208_205]).append(s[0]).toString();
/* 1376 */           for (int x = 1; x < s.length; x++)
/*      */           {
/* 1378 */             this.waitforCycle[(++this.waitforIndex)] = s[x];
/*      */           }
/*      */         }
/*      */ 
/* 1382 */         if (this.waitforIndex > 900)
/*      */         {
/* 1384 */           this.transmitted = 0;
/* 1385 */           this.waitforIndex = 0;
/* 1386 */           for (int x = 0; x < 100; x++)
/* 1387 */             this.waitforCycle[x] = this.waitforCycle[(x + 900)];
/* 1388 */           for (int x = 100; x < this.waitforCycle.length; x++)
/* 1389 */             this.waitforCycle[x] = "";
/*      */         }
/* 1391 */         this.updated = true;
/*      */ 
/* 1394 */         this.ConsoleBox.setCaretPosition(this.ConsoleBox.getDocument().getLength()); } catch (BadLocationException e) {
/*      */       }
/*      */     }
/*      */   }
/*      */ 
/*      */   public void CustomPrinting(String str, Color col) {
/* 1400 */     int beg = this.ConsoleBox.getDocument().getLength();
/* 1401 */     append(str);
/* 1402 */     MutableAttributeSet attrs = this.ConsoleBox.getInputAttributes();
/* 1403 */     StyleConstants.setForeground(attrs, col);
/* 1404 */     StyledDocument doc = this.ConsoleBox.getStyledDocument();
/* 1405 */     doc.setCharacterAttributes(beg, beg + str.length(), attrs, false);
/*      */   }
/*      */ 
/*      */   public void LMPrinting(String str) {
/* 1409 */     int beg = this.ConsoleBox.getDocument().getLength();
/* 1410 */     append(str);
/* 1411 */     MutableAttributeSet attrs = this.ConsoleBox.getInputAttributes();
/* 1412 */     StyleConstants.setForeground(attrs, new Color(0, 255, 0));
/* 1413 */     StyledDocument doc = this.ConsoleBox.getStyledDocument();
/* 1414 */     doc.setCharacterAttributes(beg, beg + str.length(), attrs, false);
/*      */   }
/*      */ 
/*      */   public void JavaPrinting(String str) {
/* 1418 */     int beg = this.ConsoleBox.getDocument().getLength();
/* 1419 */     append(str);
/* 1420 */     MutableAttributeSet attrs = this.ConsoleBox.getInputAttributes();
/* 1421 */     StyleConstants.setForeground(attrs, new Color(255, 0, 0));
/* 1422 */     StyledDocument doc = this.ConsoleBox.getStyledDocument();
/* 1423 */     doc.setCharacterAttributes(beg, beg + str.length(), attrs, false);
/*      */   }
/*      */ 
/*      */   public void actionPerformed(ActionEvent e)
/*      */   {
/*      */     try
/*      */     {
/* 1441 */       switch (Integer.parseInt(e.getActionCommand())) {
/*      */       case 0:
/* 1443 */         LoadConnectionEvent();
/* 1444 */         return;
/*      */       case 1:
/* 1445 */         ScriptFolderEvent();
/* 1446 */         return;
/*      */       case 2:
/* 1447 */         this.lineNumberStamp = (!this.lineNumberStamp);
/* 1448 */         this.LineNumberMenuItem.setText(new StringBuilder().append(this.lineNumberStamp ? "Hide " : "Show ").append("Line Numbers").toString());
/* 1449 */         return;
/*      */       case 3:
/* 1450 */         toggleCommandBox();
/* 1451 */         return;
/*      */       case 4:
/* 1452 */         createEditorWindow();
/* 1453 */         return;
/*      */       case 5:
/* 1454 */         this.shortTimestamp = (!this.shortTimestamp);
/* 1455 */         this.ShortTimestampMenuItem.setText(new StringBuilder().append(this.shortTimestamp ? "Hide " : "Show ").append("Short Timestamps").toString());
/* 1456 */         return;
/*      */       case 6:
/* 1457 */         toggleButtons();
/* 1458 */         return;
/*      */       case 7:
/* 1459 */         ExitEvent();
/* 1460 */         return;
/*      */       case 8:
/* 1461 */         this.fullTimestamp = (!this.fullTimestamp);
/* 1462 */         this.FullTimestampMenuItem.setText(new StringBuilder().append(this.fullTimestamp ? "Hide " : "Show ").append("Long Timestamps").toString());
/* 1463 */         return;
/*      */       case 9:
/* 1464 */         toggleTopToolBar();
/* 1465 */         return;
/*      */       case 10:
/* 1466 */         toggleSideBar();
/* 1467 */         return;
/*      */       case 11:
/* 1468 */         toggleBottomToolBar();
/* 1469 */         return;
/*      */       case 12:
/* 1470 */         createCustomButton();
/* 1471 */         return;
/*      */       case 13:
/* 1472 */         LoadButtonConfigEvent("");
/* 1473 */         return;
/*      */       case 14:
/* 1474 */         SaveButtonConfigEvent();
/* 1475 */         return;
/*      */       case 15:
/* 1476 */         setClipboardContents("ConsoleBox");
/* 1477 */         return;
/*      */       case 16:
/* 1478 */         appendClipboardContents("ConsoleBox");
/* 1479 */         return;
/*      */       case 17:
/* 1480 */         setClipboardContents("CommandBox");
/* 1481 */         return;
/*      */       case 18:
/* 1482 */         appendClipboardContents("CommandBox");
/* 1483 */         return;
/*      */       case 19:
/* 1484 */         deleteCustomButton();
/* 1485 */         createCustomButton();
/* 1486 */         return;
/*      */       case 20:
/* 1487 */         deleteCustomButton();
/* 1488 */         return;
/*      */       case 21:
/* 1489 */         this.commandHistory.removeAllElements();
/* 1490 */         return;
/*      */       case 30:
/* 1491 */         this.ConsoleBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[0].toString()));
/* 1492 */         return;
/*      */       case 31:
/* 1493 */         this.ConsoleBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[1].toString()));
/* 1494 */         return;
/*      */       case 32:
/* 1495 */         this.ConsoleBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[2].toString()));
/* 1496 */         return;
/*      */       case 33:
/* 1497 */         this.ConsoleBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[3].toString()));
/* 1498 */         return;
/*      */       case 34:
/* 1499 */         this.ConsoleBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[4].toString()));
/* 1500 */         return;
/*      */       case 35:
/* 1501 */         this.ConsoleBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[5].toString()));
/* 1502 */         return;
/*      */       case 36:
/* 1503 */         this.ConsoleBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[6].toString()));
/* 1504 */         return;
/*      */       case 37:
/* 1505 */         this.ConsoleBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[7].toString()));
/* 1506 */         return;
/*      */       case 38:
/* 1507 */         this.ConsoleBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[8].toString()));
/* 1508 */         return;
/*      */       case 39:
/* 1509 */         this.ConsoleBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[9].toString()));
/* 1510 */         return;
/*      */       case 40:
/* 1511 */         this.ConsoleBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[10].toString()));
/* 1512 */         return;
/*      */       case 41:
/* 1513 */         this.ConsoleBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[0].toString()));
/* 1514 */         return;
/*      */       case 42:
/* 1515 */         this.ConsoleBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[1].toString()));
/* 1516 */         return;
/*      */       case 43:
/* 1517 */         this.ConsoleBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[2].toString()));
/* 1518 */         return;
/*      */       case 44:
/* 1519 */         this.ConsoleBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[3].toString()));
/* 1520 */         return;
/*      */       case 45:
/* 1521 */         this.ConsoleBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[4].toString()));
/* 1522 */         return;
/*      */       case 46:
/* 1523 */         this.ConsoleBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[5].toString()));
/* 1524 */         return;
/*      */       case 47:
/* 1525 */         this.ConsoleBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[6].toString()));
/* 1526 */         return;
/*      */       case 48:
/* 1527 */         this.ConsoleBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[7].toString()));
/* 1528 */         return;
/*      */       case 49:
/* 1529 */         this.ConsoleBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[8].toString()));
/* 1530 */         return;
/*      */       case 50:
/* 1531 */         this.ConsoleBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[9].toString()));
/* 1532 */         return;
/*      */       case 51:
/* 1533 */         this.ConsoleBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[10].toString()));
/* 1534 */         return;
/*      */       case 52:
/* 1535 */         this.CommandBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[0].toString()));
/* 1536 */         return;
/*      */       case 53:
/* 1537 */         this.CommandBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[1].toString()));
/* 1538 */         return;
/*      */       case 54:
/* 1539 */         this.CommandBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[2].toString()));
/* 1540 */         return;
/*      */       case 55:
/* 1541 */         this.CommandBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[3].toString()));
/* 1542 */         return;
/*      */       case 56:
/* 1543 */         this.CommandBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[4].toString()));
/* 1544 */         return;
/*      */       case 57:
/* 1545 */         this.CommandBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[5].toString()));
/* 1546 */         return;
/*      */       case 58:
/* 1547 */         this.CommandBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[6].toString()));
/* 1548 */         return;
/*      */       case 59:
/* 1549 */         this.CommandBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[7].toString()));
/* 1550 */         return;
/*      */       case 60:
/* 1551 */         this.CommandBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[8].toString()));
/* 1552 */         return;
/*      */       case 61:
/* 1553 */         this.CommandBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[9].toString()));
/* 1554 */         return;
/*      */       case 62:
/* 1555 */         this.CommandBox.setBackground((Color)COLORS.get(COLORS.keySet().toArray()[10].toString()));
/* 1556 */         return;
/*      */       case 63:
/* 1557 */         this.CommandBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[0].toString()));
/* 1558 */         return;
/*      */       case 64:
/* 1559 */         this.CommandBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[1].toString()));
/* 1560 */         return;
/*      */       case 65:
/* 1561 */         this.CommandBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[2].toString()));
/* 1562 */         return;
/*      */       case 66:
/* 1563 */         this.CommandBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[3].toString()));
/* 1564 */         return;
/*      */       case 67:
/* 1565 */         this.CommandBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[4].toString()));
/* 1566 */         return;
/*      */       case 68:
/* 1567 */         this.CommandBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[5].toString()));
/* 1568 */         return;
/*      */       case 69:
/* 1569 */         this.CommandBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[6].toString()));
/* 1570 */         return;
/*      */       case 70:
/* 1571 */         this.CommandBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[7].toString()));
/* 1572 */         return;
/*      */       case 71:
/* 1573 */         this.CommandBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[8].toString()));
/* 1574 */         return;
/*      */       case 72:
/* 1575 */         this.CommandBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[9].toString()));
/* 1576 */         return;
/*      */       case 73:
/* 1577 */         this.CommandBox.setForeground((Color)COLORS.get(COLORS.keySet().toArray()[10].toString()));
/* 1578 */         return;
/*      */       case 100:
/* 1581 */         return;
/*      */       case 101:
/* 1582 */         this.SC.serConfig.setBitRate(0);
/* 1583 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1584 */         return;
/*      */       case 102:
/* 1587 */         return;
/*      */       case 103:
/* 1588 */         this.SC.serConfig.setBitRate(1);
/* 1589 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1590 */         return;
/*      */       case 104:
/* 1591 */         this.SC.serConfig.setBitRate(2);
/* 1592 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1593 */         return;
/*      */       case 105:
/* 1594 */         this.SC.serConfig.setBitRate(3);
/* 1595 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1596 */         return;
/*      */       case 106:
/* 1597 */         this.SC.serConfig.setBitRate(4);
/* 1598 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1599 */         return;
/*      */       case 107:
/* 1602 */         return;
/*      */       case 108:
/* 1603 */         this.SC.serConfig.setBitRate(5);
/* 1604 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1605 */         return;
/*      */       case 109:
/* 1606 */         this.SC.serConfig.setBitRate(6);
/* 1607 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1608 */         return;
/*      */       case 110:
/* 1611 */         return;
/*      */       case 111:
/* 1614 */         return;
/*      */       case 112:
/* 1615 */         this.SC.serConfig.setBitRate(7);
/* 1616 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1617 */         return;
/*      */       case 113:
/* 1620 */         return;
/*      */       case 114:
/* 1621 */         this.SC.serConfig.setBitRate(8);
/* 1622 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1623 */         return;
/*      */       case 115:
/* 1626 */         return;
/*      */       case 116:
/* 1627 */         this.SC.serConfig.setBitRate(9);
/* 1628 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1629 */         return;
/*      */       case 117:
/* 1630 */         this.SC.serConfig.setBitRate(10);
/* 1631 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1632 */         return;
/*      */       case 118:
/* 1633 */         this.SC.serConfig.setBitRate(11);
/* 1634 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1635 */         return;
/*      */       case 119:
/* 1638 */         return;
/*      */       case 120:
/* 1639 */         this.SC.serConfig.setDataBits(0);
/* 1640 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1641 */         return;
/*      */       case 121:
/* 1642 */         this.SC.serConfig.setDataBits(1);
/* 1643 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1644 */         return;
/*      */       case 122:
/* 1645 */         this.SC.serConfig.setDataBits(2);
/* 1646 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1647 */         return;
/*      */       case 123:
/* 1648 */         this.SC.serConfig.setDataBits(3);
/* 1649 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1650 */         return;
/*      */       case 124:
/* 1651 */         this.SC.serConfig.setParity(0);
/* 1652 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1653 */         return;
/*      */       case 125:
/* 1654 */         this.SC.serConfig.setParity(1);
/* 1655 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1656 */         return;
/*      */       case 126:
/* 1657 */         this.SC.serConfig.setParity(2);
/* 1658 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1659 */         return;
/*      */       case 127:
/* 1660 */         this.SC.serConfig.setParity(3);
/* 1661 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1662 */         return;
/*      */       case 128:
/* 1663 */         this.SC.serConfig.setParity(4);
/* 1664 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1665 */         return;
/*      */       case 129:
/* 1666 */         this.SC.serConfig.setStopBits(0);
/* 1667 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1668 */         return;
/*      */       case 131:
/* 1669 */         this.SC.serConfig.setStopBits(1);
/* 1670 */         this.SC.serialPort.configure(this.SC.serConfig);
/* 1671 */         return;
/*      */       case 132:
/* 1672 */         if (this.RtsCtsToggle.isSelected())
/*      */         {
/* 1674 */           this.SC.serialPort.setRTS(true);
/* 1675 */           this.SC.serialPort.configure(this.SC.serConfig);
/*      */         }
/*      */         else
/*      */         {
/* 1679 */           this.SC.serialPort.setRTS(false);
/* 1680 */           this.SC.serialPort.configure(this.SC.serConfig);
/*      */         }
/* 1682 */         return;
/*      */       case 133:
/* 1683 */         if (this.DTRToggle.isSelected())
/*      */         {
/* 1685 */           this.SC.serialPort.setDTR(true);
/* 1686 */           this.SC.serialPort.configure(this.SC.serConfig);
/*      */         }
/*      */         else
/*      */         {
/* 1690 */           this.SC.serialPort.setDTR(false);
/* 1691 */           this.SC.serialPort.configure(this.SC.serConfig);
/*      */         }
/* 1693 */         return;
/*      */       case 134:
/* 1694 */         JavaPrinting(new StringBuilder().append("\n\nBit rate- - - - - - ").append(getBaudrate()).append(" \n").append("Data Bits - - - - - ").append(this.SC.serialPort.getDataBits() + 5).append(" \n").append("Stop Bits - - - - - ").append(this.SC.serialPort.getStopBits() + 1).append(" \n").append("Parity- - - - - - - ").append(getParity()).append(" \n").append("Carrier Detect- - - ").append(this.SC.serialPort.sigCD()).append(" \n").append("Clear To Send - - - ").append(this.SC.serialPort.sigCTS()).append(" \n").append("Data Set Ready- - - ").append(this.SC.serialPort.sigDSR()).append(" \n").append("Overrun - - - - - - ").append(this.SC.serialPort.sigOverrun()).append(" \n \n").toString());
/*      */ 
/* 1702 */         return;
/*      */       case 22:
/*      */       case 23:
/*      */       case 24:
/*      */       case 25:
/*      */       case 26:
/*      */       case 27:
/*      */       case 28:
/*      */       case 29:
/*      */       case 74:
/*      */       case 75:
/*      */       case 76:
/*      */       case 77:
/*      */       case 78:
/*      */       case 79:
/*      */       case 80:
/*      */       case 81:
/*      */       case 82:
/*      */       case 83:
/*      */       case 84:
/*      */       case 85:
/*      */       case 86:
/*      */       case 87:
/*      */       case 88:
/*      */       case 89:
/*      */       case 90:
/*      */       case 91:
/*      */       case 92:
/*      */       case 93:
/*      */       case 94:
/*      */       case 95:
/*      */       case 96:
/*      */       case 97:
/*      */       case 98:
/*      */       case 99:
/* 1707 */       case 130: }  } catch (Exception exc) { exc.printStackTrace();
/*      */     }
/* 1709 */     Object[] keys = this.ToolBarMapping.keySet().toArray();
/*      */ 
/* 1711 */     for (int x = 0; x < keys.length; x++)
/*      */     {
/* 1713 */       if (!e.getActionCommand().equals(keys[x].toString()))
/*      */         continue;
/* 1715 */       String cmdOrScript = ((String)this.ToolBarMapping.get(keys[x])).split("/")[0];
/* 1716 */       if (cmdOrScript.contains(".py")) {
/* 1717 */         RunScriptEvent(cmdOrScript);
/*      */       }
/* 1719 */       else if (this.SSH)
/* 1720 */         this.SSHC.sendCommand(cmdOrScript);
/*      */       else
/* 1722 */         this.SC.sendCommand(cmdOrScript);
/*      */     }
/*      */   }
/*      */ 
/*      */   private int getBaudrate()
/*      */   {
/* 1729 */     int bRate = this.SC.serialPort.getBitRate();
/*      */ 
/* 1731 */     switch (bRate) {
/*      */     case 0:
/* 1733 */       return 110;
/*      */     case 1:
/* 1734 */       return 150;
/*      */     case 2:
/* 1735 */       return 300;
/*      */     case 3:
/* 1736 */       return 600;
/*      */     case 4:
/* 1737 */       return 1200;
/*      */     case 5:
/* 1738 */       return 2400;
/*      */     case 6:
/* 1739 */       return 4800;
/*      */     case 7:
/* 1740 */       return 9600;
/*      */     case 8:
/* 1741 */       return 19200;
/*      */     case 9:
/* 1742 */       return 38400;
/*      */     case 10:
/* 1743 */       return 57600;
/*      */     case 11:
/* 1744 */       return 115200;
/* 1745 */     }return -1;
/*      */   }
/*      */ 
/*      */   private String getParity()
/*      */   {
/* 1750 */     int par = this.SC.serialPort.getParity();
/*      */ 
/* 1752 */     switch (par) {
/*      */     case 0:
/* 1754 */       return "None";
/*      */     case 1:
/* 1755 */       return "Odd";
/*      */     case 2:
/* 1756 */       return "Even";
/*      */     case 3:
/* 1757 */       return "Mark";
/*      */     case 4:
/* 1758 */       return "Space";
/* 1759 */     }return "null";
/*      */   }
/*      */ 
/*      */   private void appendClipboardContents(String originator)
/*      */   {
/* 1769 */     String result = "";
/* 1770 */     Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
/*      */ 
/* 1772 */     Transferable contents = clipboard.getContents(null);
/* 1773 */     boolean hasTransferableText = (contents != null) && (contents.isDataFlavorSupported(DataFlavor.stringFlavor));
/*      */ 
/* 1775 */     if (hasTransferableText)
/*      */     {
/*      */       try
/*      */       {
/* 1779 */         result = (String)contents.getTransferData(DataFlavor.stringFlavor);
/*      */ 
/* 1781 */         if (originator.equals("ConsoleBox"))
/*      */         {
/* 1783 */           if (this.SSH)
/* 1784 */             this.SSHC.simpleSendCommand(result);
/*      */           else
/* 1786 */             this.SC.simpleSendCommand(result);
/*      */         }
/* 1788 */         if (originator.equals("CommandBox"))
/*      */         {
/* 1790 */           this.CommandBox.setText(result);
/*      */         }
/*      */ 
/*      */       }
/*      */       catch (UnsupportedFlavorException ex)
/*      */       {
/* 1797 */         ex.printStackTrace();
/*      */       }
/*      */       catch (IOException ex)
/*      */       {
/* 1801 */         ex.printStackTrace();
/*      */       }
/*      */     }
/*      */   }
/*      */ 
/*      */   private void BuildBaudrateMenu()
/*      */   {
/* 1808 */     this.BaudrateToolLeftClickMenu = new JPopupMenu();
/*      */ 
/* 1810 */     this.Baudrate110MenuItem = new JMenuItem();
/*      */ 
/* 1812 */     this.Baudrate150MenuItem = new JMenuItem();
/* 1813 */     this.Baudrate300MenuItem = new JMenuItem();
/* 1814 */     this.Baudrate600MenuItem = new JMenuItem();
/* 1815 */     this.Baudrate1200MenuItem = new JMenuItem();
/*      */ 
/* 1817 */     this.Baudrate2400MenuItem = new JMenuItem();
/* 1818 */     this.Baudrate4800MenuItem = new JMenuItem();
/*      */ 
/* 1821 */     this.Baudrate9600MenuItem = new JMenuItem();
/*      */ 
/* 1823 */     this.Baudrate19200MenuItem = new JMenuItem();
/*      */ 
/* 1825 */     this.Baudrate38400MenuItem = new JMenuItem();
/* 1826 */     this.Baudrate57600MenuItem = new JMenuItem();
/* 1827 */     this.Baudrate115200MenuItem = new JMenuItem();
/*      */ 
/* 1831 */     this.Baudrate110MenuItem.setText("110");
/*      */ 
/* 1833 */     this.Baudrate150MenuItem.setText("150");
/* 1834 */     this.Baudrate300MenuItem.setText("300");
/* 1835 */     this.Baudrate600MenuItem.setText("600");
/* 1836 */     this.Baudrate1200MenuItem.setText("1200");
/*      */ 
/* 1838 */     this.Baudrate2400MenuItem.setText("2400");
/* 1839 */     this.Baudrate4800MenuItem.setText("4800");
/*      */ 
/* 1842 */     this.Baudrate9600MenuItem.setText("9600");
/*      */ 
/* 1844 */     this.Baudrate19200MenuItem.setText("19200");
/*      */ 
/* 1846 */     this.Baudrate38400MenuItem.setText("38400");
/* 1847 */     this.Baudrate57600MenuItem.setText("57600");
/* 1848 */     this.Baudrate115200MenuItem.setText("115200");
/*      */ 
/* 1852 */     this.Baudrate110MenuItem.setActionCommand("101");
/*      */ 
/* 1854 */     this.Baudrate150MenuItem.setActionCommand("103");
/* 1855 */     this.Baudrate300MenuItem.setActionCommand("104");
/* 1856 */     this.Baudrate600MenuItem.setActionCommand("105");
/* 1857 */     this.Baudrate1200MenuItem.setActionCommand("106");
/*      */ 
/* 1859 */     this.Baudrate2400MenuItem.setActionCommand("108");
/* 1860 */     this.Baudrate4800MenuItem.setActionCommand("109");
/*      */ 
/* 1863 */     this.Baudrate9600MenuItem.setActionCommand("112");
/*      */ 
/* 1865 */     this.Baudrate19200MenuItem.setActionCommand("114");
/*      */ 
/* 1867 */     this.Baudrate38400MenuItem.setActionCommand("116");
/* 1868 */     this.Baudrate57600MenuItem.setActionCommand("117");
/* 1869 */     this.Baudrate115200MenuItem.setActionCommand("118");
/*      */ 
/* 1873 */     this.Baudrate110MenuItem.addActionListener(this);
/*      */ 
/* 1875 */     this.Baudrate150MenuItem.addActionListener(this);
/* 1876 */     this.Baudrate300MenuItem.addActionListener(this);
/* 1877 */     this.Baudrate600MenuItem.addActionListener(this);
/* 1878 */     this.Baudrate1200MenuItem.addActionListener(this);
/*      */ 
/* 1880 */     this.Baudrate2400MenuItem.addActionListener(this);
/* 1881 */     this.Baudrate4800MenuItem.addActionListener(this);
/*      */ 
/* 1884 */     this.Baudrate9600MenuItem.addActionListener(this);
/*      */ 
/* 1886 */     this.Baudrate19200MenuItem.addActionListener(this);
/*      */ 
/* 1888 */     this.Baudrate38400MenuItem.addActionListener(this);
/* 1889 */     this.Baudrate57600MenuItem.addActionListener(this);
/* 1890 */     this.Baudrate115200MenuItem.addActionListener(this);
/*      */ 
/* 1894 */     this.BaudrateToolLeftClickMenu.add(this.Baudrate110MenuItem);
/*      */ 
/* 1896 */     this.BaudrateToolLeftClickMenu.add(this.Baudrate150MenuItem);
/* 1897 */     this.BaudrateToolLeftClickMenu.add(this.Baudrate300MenuItem);
/* 1898 */     this.BaudrateToolLeftClickMenu.add(this.Baudrate600MenuItem);
/* 1899 */     this.BaudrateToolLeftClickMenu.add(this.Baudrate1200MenuItem);
/*      */ 
/* 1901 */     this.BaudrateToolLeftClickMenu.add(this.Baudrate2400MenuItem);
/* 1902 */     this.BaudrateToolLeftClickMenu.add(this.Baudrate4800MenuItem);
/*      */ 
/* 1905 */     this.BaudrateToolLeftClickMenu.add(this.Baudrate9600MenuItem);
/*      */ 
/* 1907 */     this.BaudrateToolLeftClickMenu.add(this.Baudrate19200MenuItem);
/*      */ 
/* 1909 */     this.BaudrateToolLeftClickMenu.add(this.Baudrate38400MenuItem);
/* 1910 */     this.BaudrateToolLeftClickMenu.add(this.Baudrate57600MenuItem);
/* 1911 */     this.BaudrateToolLeftClickMenu.add(this.Baudrate115200MenuItem);
/*      */   }
/*      */ 
/*      */   private void BuildDataBitsMenu()
/*      */   {
/* 1916 */     this.DataBitsToolLeftClickMenu = new JPopupMenu();
/* 1917 */     this.DataBits5MenuItem = new JMenuItem();
/* 1918 */     this.DataBits6MenuItem = new JMenuItem();
/* 1919 */     this.DataBits7MenuItem = new JMenuItem();
/* 1920 */     this.DataBits8MenuItem = new JMenuItem();
/*      */ 
/* 1922 */     this.DataBits5MenuItem.setText("5");
/* 1923 */     this.DataBits6MenuItem.setText("6");
/* 1924 */     this.DataBits7MenuItem.setText("7");
/* 1925 */     this.DataBits8MenuItem.setText("8");
/*      */ 
/* 1927 */     this.DataBits5MenuItem.setActionCommand("120");
/* 1928 */     this.DataBits6MenuItem.setActionCommand("121");
/* 1929 */     this.DataBits7MenuItem.setActionCommand("122");
/* 1930 */     this.DataBits8MenuItem.setActionCommand("123");
/*      */ 
/* 1932 */     this.DataBits5MenuItem.addActionListener(this);
/* 1933 */     this.DataBits6MenuItem.addActionListener(this);
/* 1934 */     this.DataBits7MenuItem.addActionListener(this);
/* 1935 */     this.DataBits8MenuItem.addActionListener(this);
/*      */ 
/* 1937 */     this.DataBitsToolLeftClickMenu.add(this.DataBits5MenuItem);
/* 1938 */     this.DataBitsToolLeftClickMenu.add(this.DataBits6MenuItem);
/* 1939 */     this.DataBitsToolLeftClickMenu.add(this.DataBits7MenuItem);
/* 1940 */     this.DataBitsToolLeftClickMenu.add(this.DataBits8MenuItem);
/*      */   }
/*      */ 
/*      */   private void BuildParityMenu() {
/* 1944 */     this.ParityToolLeftClickMenu = new JPopupMenu();
/* 1945 */     this.ParityNoneMenuItem = new JMenuItem();
/* 1946 */     this.ParityOddMenuItem = new JMenuItem();
/* 1947 */     this.ParityEvenMenuItem = new JMenuItem();
/* 1948 */     this.ParityMarkMenuItem = new JMenuItem();
/* 1949 */     this.ParitySpaceMenuItem = new JMenuItem();
/*      */ 
/* 1951 */     this.ParityNoneMenuItem.setText("None");
/* 1952 */     this.ParityOddMenuItem.setText("Odd");
/* 1953 */     this.ParityEvenMenuItem.setText("Even");
/* 1954 */     this.ParityMarkMenuItem.setText("Mark");
/* 1955 */     this.ParitySpaceMenuItem.setText("Space");
/*      */ 
/* 1957 */     this.ParityNoneMenuItem.setActionCommand("124");
/* 1958 */     this.ParityOddMenuItem.setActionCommand("125");
/* 1959 */     this.ParityEvenMenuItem.setActionCommand("126");
/* 1960 */     this.ParityMarkMenuItem.setActionCommand("127");
/* 1961 */     this.ParitySpaceMenuItem.setActionCommand("128");
/*      */ 
/* 1963 */     this.ParityNoneMenuItem.addActionListener(this);
/* 1964 */     this.ParityOddMenuItem.addActionListener(this);
/* 1965 */     this.ParityEvenMenuItem.addActionListener(this);
/* 1966 */     this.ParityMarkMenuItem.addActionListener(this);
/* 1967 */     this.ParitySpaceMenuItem.addActionListener(this);
/*      */ 
/* 1969 */     this.ParityToolLeftClickMenu.add(this.ParityNoneMenuItem);
/* 1970 */     this.ParityToolLeftClickMenu.add(this.ParityOddMenuItem);
/* 1971 */     this.ParityToolLeftClickMenu.add(this.ParityEvenMenuItem);
/* 1972 */     this.ParityToolLeftClickMenu.add(this.ParityMarkMenuItem);
/* 1973 */     this.ParityToolLeftClickMenu.add(this.ParitySpaceMenuItem);
/*      */   }
/*      */ 
/*      */   private void BuildStopBitsMenu() {
/* 1977 */     this.StopBitsToolLeftClickMenu = new JPopupMenu();
/* 1978 */     this.StopBits1MenuItem = new JMenuItem();
/* 1979 */     this.StopBits15MenuItem = new JMenuItem();
/* 1980 */     this.StopBits2MenuItem = new JMenuItem();
/*      */ 
/* 1982 */     this.StopBits1MenuItem.setText("1");
/* 1983 */     this.StopBits15MenuItem.setText("1.5");
/* 1984 */     this.StopBits2MenuItem.setText("2");
/*      */ 
/* 1986 */     this.StopBits1MenuItem.setActionCommand("129");
/* 1987 */     this.StopBits15MenuItem.setActionCommand("130");
/* 1988 */     this.StopBits2MenuItem.setActionCommand("131");
/*      */ 
/* 1990 */     this.StopBits1MenuItem.addActionListener(this);
/* 1991 */     this.StopBits15MenuItem.addActionListener(this);
/* 1992 */     this.StopBits2MenuItem.addActionListener(this);
/*      */ 
/* 1994 */     this.StopBitsToolLeftClickMenu.add(this.StopBits1MenuItem);
/* 1995 */     this.StopBitsToolLeftClickMenu.add(this.StopBits15MenuItem);
/* 1996 */     this.StopBitsToolLeftClickMenu.add(this.StopBits2MenuItem);
/*      */   }
/*      */ 
/*      */   private void ClearScreenButtonmouseReleased()
/*      */   {
/* 2002 */     this.ConsoleBox.setText("");
/*      */   }
/*      */ 
/*      */   private void CommandBoxEnterPressed(KeyEvent evt)
/*      */   {
/*      */     try
/*      */     {
/* 2011 */       String[] temp = this.CommandBox.getText().split("\n");
/* 2012 */       String command = "";
/*      */ 
/* 2014 */       for (int x = 0; x < temp.length; x++)
/*      */       {
/* 2016 */         command = temp[x];
/* 2017 */         if (this.SSH)
/*      */         {
/* 2019 */           this.SSHC.sendCommand(command);
/*      */         }
/*      */         else
/*      */         {
/* 2023 */           this.SC.sendCommand(command);
/*      */         }
/* 2025 */         this.waitforIndex = ((this.waitforIndex + 1) % 50);
/*      */ 
/* 2028 */         waitfor(">", 5000, 100, null);
/*      */ 
/* 2033 */         System.out.println("here");
/*      */       }
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/*      */     }
/*      */   }
/*      */ 
/*      */   private void ConfigScriptFolderEvent()
/*      */   {
/*      */     try
/*      */     {
/* 2051 */       JFileChooser fc = new JFileChooser();
/* 2052 */       fc.setFileSelectionMode(1);
/* 2053 */       fc.setCurrentDirectory(this.loadedFileDirectory.isEmpty() ? new File(".") : (File)this.loadedFileDirectory.get(0));
/* 2054 */       int returnVal = fc.showOpenDialog(this.ConfigScriptFolderButton);
/*      */ 
/* 2056 */       if (returnVal == 0)
/*      */       {
/* 2058 */         this.scriptFolderModel.removeAllElements();
/* 2059 */         this.loadedFileDirectory.clear();
/*      */ 
/* 2061 */         File folder = new File(fc.getSelectedFile().getAbsolutePath());
/* 2062 */         File[] temp = folder.listFiles();
/* 2063 */         for (int x = 0; x < temp.length; x++)
/*      */         {
/* 2065 */           if (temp[x].getName().contains(".py")) {
/* 2066 */             this.loadedFileDirectory.add(temp[x]);
/*      */           }
/*      */         }
/* 2069 */         for (int x = 0; x < this.loadedFileDirectory.size(); x++)
/*      */         {
/* 2071 */           this.scriptFolderModel.addElement(((File)this.loadedFileDirectory.get(x)).getName());
/*      */         }
/*      */       }
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/* 2077 */       e.printStackTrace();
/*      */     }
/*      */   }
/*      */ 
/*      */   private void ConnectButtonmouseReleased()
/*      */   {
/* 2086 */     if (this.SSH)
/*      */     {
/* 2088 */       this.SSHC.reLogin();
/* 2089 */       this.ConnectButton.setVisible(false);
/* 2090 */       this.DisconnectButton.setVisible(true);
/*      */     }
/*      */     else
/*      */     {
/* 2094 */       this.TLGUI.restartSerialPort(this.windowNumber);
/* 2095 */       this.ConnectButton.setVisible(false);
/* 2096 */       this.DisconnectButton.setVisible(true);
/*      */     }
/*      */   }
/*      */ 
/*      */   private void ConsoleBoxKeyTyped(KeyEvent evt)
/*      */   {
/* 2105 */     String cmd = new StringBuilder().append("").append(evt.getKeyChar()).toString();
/*      */ 
/* 2107 */     evt.consume();
/* 2108 */     if (this.SSH)
/* 2109 */       this.SSHC.simpleSendCommand(cmd);
/*      */     else
/* 2111 */       this.SC.simpleSendCommand(cmd);
/*      */   }
/*      */ 
/*      */   private void createCustomButton()
/*      */   {
/* 2120 */     String commandName = JOptionPane.showInternalInputDialog(this.MainPanel, "Please Enter Your Desired Button Name:");
/*      */ 
/* 2122 */     if (commandName != null)
/*      */     {
/* 2124 */       JButton temp = new JButton(new StringBuilder().append("    ").append(commandName).append("    ").toString());
/*      */ 
/* 2126 */       JOptionPane getCommand = new JOptionPane("Pick the Option to Enter a Desired\nCommand or to Select a Script:");
/*      */ 
/* 2129 */       JButton EnterCommandButton = new JButton("Enter Command");
/* 2130 */       EnterCommandButton.addMouseListener(new MouseAdapter(getCommand) {
/*      */         public void mouseReleased(MouseEvent evt) {
/* 2132 */           String in = JOptionPane.showInputDialog(Communicator.this.MainPanel, "Please Enter Your Desired Command:");
/* 2133 */           this.val$getCommand.setInputValue(in);
/* 2134 */           this.val$getCommand.setValue(Integer.valueOf(0));
/*      */         }
/*      */       });
/* 2138 */       JButton CancelButton = new JButton("Cancel");
/* 2139 */       CancelButton.addMouseListener(new MouseAdapter(getCommand) {
/*      */         public void mouseReleased(MouseEvent evt) {
/* 2141 */           this.val$getCommand.setValue(Integer.valueOf(2));
/*      */         }
/*      */       });
/* 2145 */       JButton ScriptButton = new JButton("Select Script");
/* 2146 */       ScriptButton.addMouseListener(new MouseAdapter(ScriptButton, getCommand) {
/*      */         public void mouseReleased(MouseEvent evt) {
/* 2148 */           JFileChooser fc = new JFileChooser();
/* 2149 */           fc.setCurrentDirectory(new File("Scripts/"));
/* 2150 */           int returnVal = fc.showOpenDialog(this.val$ScriptButton);
/*      */ 
/* 2152 */           if (returnVal == 0)
/*      */           {
/* 2154 */             this.val$getCommand.setInputValue(fc.getSelectedFile().getAbsolutePath());
/*      */           }
/*      */ 
/* 2157 */           this.val$getCommand.setValue(Integer.valueOf(1));
/*      */         }
/*      */       });
/* 2161 */       Object[] buttonAddition = { ScriptButton, EnterCommandButton, CancelButton };
/*      */ 
/* 2163 */       getCommand.setOptions(buttonAddition);
/* 2164 */       getCommand.createDialog(this.MainPanel, "Something").setVisible(true);
/*      */ 
/* 2168 */       String cmd = getCommand.getInputValue().toString();
/*      */ 
/* 2170 */       if (!cmd.equals("uninitializedValue"))
/*      */       {
/* 2172 */         temp.setBackground(new Color(200, 200, 255));
/* 2173 */         temp.setBorder(BorderFactory.createEtchedBorder(0));
/*      */ 
/* 2175 */         temp.setActionCommand(new StringBuilder().append(500 + this.ToolBarMapping.size()).append("").toString());
/* 2176 */         temp.addActionListener(this);
/* 2177 */         temp.setMaximumSize(new Dimension(131, 25));
/* 2178 */         temp.setMinimumSize(new Dimension(131, 25));
/* 2179 */         temp.setPreferredSize(new Dimension(131, 25));
/* 2180 */         temp.addMouseListener(new MouseAdapter(temp)
/*      */         {
/*      */           public void mouseReleased(MouseEvent evt) {
/* 2183 */             if (evt.isPopupTrigger())
/*      */             {
/* 2185 */               int x = evt.getX();
/* 2186 */               int y = evt.getY();
/*      */ 
/* 2188 */               this.val$temp.requestFocus(true);
/* 2189 */               Communicator.access$1102(Communicator.this, Integer.parseInt(this.val$temp.getActionCommand()) - 500);
/* 2190 */               Communicator.this.CustomButtonRightClickMenu.show(this.val$temp, x, y);
/*      */             }
/*      */           }
/*      */         });
/* 2194 */         this.ToolBarMapping.put(Integer.valueOf(this.ToolBarMapping.size() + 500), new StringBuilder().append(cmd).append("/").append(commandName).toString());
/*      */ 
/* 2196 */         this.CustomButtonsToolBar.add(temp);
/*      */         try
/*      */         {
/* 2200 */           if (isMaximum())
/*      */           {
/* 2202 */             setMaximum(false);
/* 2203 */             setMaximum(true);
/*      */           }
/*      */           else
/*      */           {
/* 2207 */             Rectangle r = getBounds();
/* 2208 */             reshape((int)r.getX(), (int)r.getY(), (int)r.getWidth(), (int)r.getHeight());
/*      */           }
/*      */         }
/*      */         catch (Exception e)
/*      */         {
/*      */         }
/*      */       }
/*      */     }
/*      */   }
/*      */ 
/*      */   protected void createEditorWindow()
/*      */   {
/*      */     try
/*      */     {
/* 2225 */       File dir = new File(".");
/* 2226 */       String fileDir = new StringBuilder().append(dir.getAbsolutePath()).append("/NotepadPP/notepadPP.exe ").append(this.scriptFromComboBox ? ((File)this.loadedFileDirectory.get(this.ScriptFolderComboBox.getSelectedIndex())).getAbsolutePath() : ((File)this.loadedFiles.get(this.LoadedScriptsList.getSelectedIndex())).getAbsolutePath()).toString();
/*      */ 
/* 2229 */       Runtime rt = Runtime.getRuntime();
/* 2230 */       proc = rt.exec(fileDir);
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/*      */       Process proc;
/*      */       try
/*      */       {
/*      */         Process proc;
/* 2236 */         File dir = new File(".");
/* 2237 */         String fileDir = new StringBuilder().append(dir.getAbsolutePath()).append("/NotepadPP/notepadPP.exe").toString();
/* 2238 */         Runtime rt = Runtime.getRuntime();
/* 2239 */         proc = rt.exec(fileDir);
/*      */       }
/*      */       catch (Exception e3)
/*      */       {
/*      */       }
/*      */     }
/*      */   }
/*      */ 
/*      */   private void deleteCustomButton()
/*      */   {
/* 2254 */     this.CustomButtonsToolBar.remove(this.rightClickedCustomButton);
/* 2255 */     this.ToolBarMapping.remove(Integer.valueOf(this.rightClickedCustomButton));
/* 2256 */     pack();
/*      */   }
/*      */ 
/*      */   private void DisconnectButtonmouseReleased()
/*      */   {
/*      */     try
/*      */     {
/* 2266 */       if (this.SSH)
/*      */       {
/* 2268 */         if (this.SSHC.safeToDisconnect())
/*      */         {
/* 2270 */           this.SSHC.closeStreams();
/* 2271 */           this.ConnectButton.setVisible(true);
/* 2272 */           this.DisconnectButton.setVisible(false);
/*      */         }
/*      */       }
/*      */       else
/*      */       {
/* 2277 */         this.SC.closeStreams();
/* 2278 */         this.ConnectButton.setVisible(true);
/* 2279 */         this.DisconnectButton.setVisible(false);
/*      */       }
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/*      */     }
/*      */   }
/*      */ 
/*      */   public void ExitEvent()
/*      */   {
/* 2293 */     File file = new File("Options/LoadedFiles.txt");
/* 2294 */     file.delete();
/* 2295 */     File newfile = new File("Options/LoadedFiles.txt");
/*      */     try
/*      */     {
/* 2299 */       newfile.createNewFile();
/*      */ 
/* 2301 */       FileWriter fstream = new FileWriter(newfile);
/* 2302 */       BufferedWriter out = new BufferedWriter(fstream);
/*      */ 
/* 2304 */       for (int x = 0; x < this.loadedFiles.size(); x++)
/*      */       {
/* 2306 */         if (this.loadedFiles.get(x) != null) {
/* 2307 */           out.write(new StringBuilder().append(((File)this.loadedFiles.get(x)).getAbsolutePath()).append("\n").toString());
/*      */         }
/*      */       }
/*      */ 
/* 2311 */       out.close();
/*      */ 
/* 2313 */       if (this.SSH)
/* 2314 */         this.SSHC.closeStreams();
/*      */       else {
/* 2316 */         this.SC.closeStreams();
/*      */       }
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/*      */     }
/*      */ 
/* 2323 */     dispose();
/*      */   }
/*      */ 
/*      */   public String getPortName()
/*      */   {
/* 2332 */     return this.portName;
/*      */   }
/*      */ 
/*      */   private void LoadButtonConfigEvent(String possibleDir)
/*      */   {
/* 2349 */     JFileChooser fc = new JFileChooser();
/*      */     int returnVal;
/*      */     int returnVal;
/* 2351 */     if (possibleDir.equals(""))
/*      */     {
/* 2353 */       fc.setCurrentDirectory(new File("Options/"));
/* 2354 */       returnVal = fc.showOpenDialog(this.LoadScriptButton);
/*      */     }
/*      */     else
/*      */     {
/* 2358 */       returnVal = 0;
/*      */     }
/*      */ 
/* 2361 */     if (returnVal == 0)
/*      */     {
/*      */       File file;
/*      */       File file;
/* 2364 */       if (possibleDir.equals(""))
/* 2365 */         file = fc.getSelectedFile();
/*      */       else
/* 2367 */         file = new File(possibleDir);
/* 2368 */       FileReader fis = null;
/* 2369 */       BufferedReader in = null;
/*      */       try
/*      */       {
/* 2373 */         fis = new FileReader(file);
/*      */ 
/* 2375 */         in = new BufferedReader(fis);
/*      */ 
/* 2377 */         int counter = 0;
/*      */ 
/* 2379 */         while (in.ready())
/*      */         {
/* 2381 */           String line = in.readLine();
/* 2382 */           String[] splitLine = line.split("/");
/*      */ 
/* 2384 */           JButton temp = new JButton(new StringBuilder().append("    ").append(splitLine[2]).append("    ").toString());
/* 2385 */           temp.setBackground(new Color(200, 200, 255));
/* 2386 */           temp.setBorder(BorderFactory.createEtchedBorder(0));
/*      */ 
/* 2388 */           temp.setActionCommand(splitLine[0]);
/* 2389 */           temp.addActionListener(this);
/* 2390 */           temp.setMaximumSize(new Dimension(131, 25));
/* 2391 */           temp.addMouseListener(new MouseAdapter(temp)
/*      */           {
/*      */             public void mouseReleased(MouseEvent evt) {
/* 2394 */               if (evt.isPopupTrigger())
/*      */               {
/* 2396 */                 int x = evt.getX();
/* 2397 */                 int y = evt.getY();
/*      */ 
/* 2399 */                 this.val$temp.requestFocus(true);
/* 2400 */                 Communicator.access$1102(Communicator.this, Integer.parseInt(this.val$temp.getActionCommand()) - 50);
/* 2401 */                 Communicator.this.CustomButtonRightClickMenu.show(this.val$temp, x, y);
/*      */               }
/*      */             }
/*      */           });
/* 2405 */           this.ToolBarMapping.put(Integer.valueOf(Integer.parseInt(splitLine[0])), new StringBuilder().append(splitLine[1]).append("/").append(splitLine[2]).toString());
/*      */ 
/* 2407 */           this.CustomButtonsToolBar.add(temp);
/*      */ 
/* 2409 */           if (isMaximum())
/*      */           {
/* 2411 */             setMaximum(false);
/* 2412 */             setMaximum(true);
/*      */           }
/*      */           else
/*      */           {
/* 2416 */             Rectangle r = getNormalBounds();
/* 2417 */             reshape((int)r.getX(), (int)r.getY(), (int)r.getWidth(), (int)r.getHeight());
/*      */           }
/*      */ 
/*      */         }
/*      */ 
/* 2422 */         in.close();
/*      */ 
/* 2424 */         fis.close();
/*      */       }
/*      */       catch (Exception e) {
/* 2427 */         e.printStackTrace();
/*      */       }
/*      */     }
/*      */   }
/*      */ 
/*      */   private void LoadConnectionEvent()
/*      */   {
/*      */     try
/*      */     {
/* 2438 */       if (this.SC != null)
/*      */       {
/* 2440 */         System.out.println("SERIAL CLOSING");
/* 2441 */         this.SC.closeStreams();
/*      */       }
/* 2443 */       if (this.SSHC != null)
/*      */       {
/* 2445 */         System.out.println("SSH CLOSING");
/* 2446 */         this.SSHC.closeStreams();
/*      */       }
/* 2448 */       String[] temp = (String[])TopLevelGUI.ConnectionDirectory.get(this.ConnectionDirectoryComboBox.getSelectedItem());
/*      */ 
/* 2450 */       this.portName = temp[1];
/*      */ 
/* 2452 */       if (temp[18].equals("SSH"))
/*      */       {
/* 2454 */         this.SSH = true;
/* 2455 */         this.SSHC = new SSHCommunicator(this.ConnectionDirectoryComboBox.getSelectedItem().toString(), this.TLGUI);
/* 2456 */         this.SSHC.getLoginInfoFromCD();
/* 2457 */         this.SSHC.setSPC(this, true);
/* 2458 */         this.LM = new LibraryMethods(this, this.SSHC);
/* 2459 */         this.SSHC.reLogin();
/* 2460 */         this.ConnectButton.setVisible(false);
/* 2461 */         this.DisconnectButton.setVisible(true);
/* 2462 */         setVisible(true);
/* 2463 */         setTitle(new StringBuilder().append(this.portName).append(" --- SSH Communicator").toString());
/*      */       }
/*      */       else
/*      */       {
/* 2467 */         this.SSH = false;
/* 2468 */         this.SC = new SerialPortCommunicator(temp[1], this.TLGUI, Integer.parseInt(temp[2]), Integer.parseInt(temp[4]), Integer.parseInt(temp[3]), Integer.parseInt(temp[5]));
/* 2469 */         this.LM = new LibraryMethods(this, this.SC);
/* 2470 */         this.SC.setSPC(this);
/* 2471 */         new Thread() {
/*      */           public void run() {
/* 2473 */             Communicator.this.SC.connect();
/*      */           }
/*      */         }
/* 2471 */         .start();
/*      */ 
/* 2476 */         this.ConnectButton.setVisible(false);
/* 2477 */         this.DisconnectButton.setVisible(true);
/* 2478 */         setTitle(new StringBuilder().append(this.portName).append(" --- Serial Communicator").toString());
/*      */       }
/* 2480 */       this.ConsoleBox.setBackground((Color)COLORS.get(temp[6]));
/* 2481 */       this.ConsoleBox.setForeground((Color)COLORS.get(temp[7]));
/* 2482 */       this.CommandBox.setCaretColor((Color)COLORS.get(temp[7]));
/* 2483 */       this.ConsoleBox.setFont(new Font(temp[8], 0, 12));
/* 2484 */       this.CommandBox.setBackground((Color)COLORS.get(temp[9]));
/* 2485 */       this.CommandBox.setForeground((Color)COLORS.get(temp[10]));
/* 2486 */       this.CommandBox.setCaretColor((Color)COLORS.get(temp[10]));
/* 2487 */       this.CommandBox.setFont(new Font(temp[11], 0, 12));
/*      */ 
/* 2489 */       this.scriptFolderModel.removeAllElements();
/* 2490 */       this.loadedFileDirectory.clear();
/*      */ 
/* 2492 */       File folder = new File(temp[12]);
/* 2493 */       File[] t = folder.listFiles();
/* 2494 */       for (int x = 0; x < t.length; x++)
/*      */       {
/* 2496 */         if (t[x].getName().contains(".py"))
/* 2497 */           this.loadedFileDirectory.add(t[x]);
/*      */       }
/* 2499 */       if (this.loadedFileDirectory.size() == 0) {
/* 2500 */         JOptionPane.showMessageDialog(null, "Script folder doesn't exist.", "Error", 0);
/*      */       }
/*      */       else {
/* 2503 */         for (int x = 0; x < this.loadedFileDirectory.size(); x++)
/*      */         {
/* 2505 */           this.scriptFolderModel.addElement(((File)this.loadedFileDirectory.get(x)).getName());
/*      */         }
/*      */       }
/*      */ 
/* 2509 */       this.libraryDirectory = temp[13];
/*      */ 
/* 2511 */       if (temp[14].equals("false"))
/* 2512 */         toggleBottomToolBar();
/* 2513 */       if (temp[15].equals("false"))
/* 2514 */         toggleSideBar();
/* 2515 */       if (temp[16].equals("false")) {
/* 2516 */         toggleTopToolBar();
/*      */       }
/* 2518 */       for (int x = this.ToolBarMapping.size() - 1; x >= 0; x--)
/*      */       {
/* 2520 */         this.rightClickedCustomButton = x;
/* 2521 */         deleteCustomButton();
/*      */       }
/* 2523 */       LoadButtonConfigEvent(temp[17]);
/*      */ 
/* 2525 */       this.logBaseName = temp[19];
/* 2526 */       this.logDirectory = temp[20];
/* 2527 */       this.logOutputType = temp[21].equals("true");
/*      */ 
/* 2529 */       int num = Integer.parseInt(temp[22]);
/* 2530 */       this.loadedFiles.clear();
/* 2531 */       this.scriptListModel.removeAllElements();
/* 2532 */       for (int x = 0; x < num; x++)
/*      */       {
/* 2534 */         this.loadedFiles.add(new File(temp[(23 + x)]));
/* 2535 */         this.scriptListModel.addElement(((File)this.loadedFiles.get(this.loadedFiles.size() - 1)).getName());
/*      */       }
/*      */ 
/* 2540 */       repaint();
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/* 2544 */       e.printStackTrace();
/*      */     }
/*      */   }
/*      */ 
/*      */   private void LoadScriptEvent()
/*      */   {
/*      */     try
/*      */     {
/* 2554 */       JFileChooser fc = new JFileChooser();
/* 2555 */       fc.setCurrentDirectory(new File("Scripts/"));
/* 2556 */       fc.setMultiSelectionEnabled(true);
/* 2557 */       int returnVal = fc.showOpenDialog(this.LoadScriptButton);
/*      */ 
/* 2559 */       if (returnVal == 0)
/*      */       {
/* 2561 */         File[] temp = fc.getSelectedFiles();
/* 2562 */         for (int counter = 0; counter < temp.length; counter++)
/*      */         {
/* 2564 */           this.loadedFiles.add(temp[counter]);
/* 2565 */           this.scriptListModel.addElement(((File)this.loadedFiles.get(this.loadedFiles.size() - 1)).getName());
/*      */         }
/*      */       }
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/*      */     }
/*      */   }
/*      */ 
/*      */   private void LogDataButtonMouseReleased()
/*      */   {
/*      */     try
/*      */     {
/* 2594 */       this.logBoolean = (!this.logBoolean);
/*      */ 
/* 2596 */       if (this.logBoolean)
/*      */       {
/* 2598 */         this.dataLogStartLine = this.ConsoleBox.getText().split("\n").length;
/* 2599 */         this.LogDataButton.setBackground(new Color(151, 222, 151));
/*      */       }
/*      */       else
/*      */       {
/* 2603 */         this.LogDataButton.setBackground(UIManager.getColor("JButton.background"));
/*      */ 
/* 2605 */         File logFile = new File(new StringBuilder().append(this.logDirectory.replace("\\", "/")).append("/").append(this.logBaseName).append("0.").append(this.logOutputType ? "html" : "txt").toString());
/* 2606 */         int x = 1;
/* 2607 */         while (logFile.exists())
/*      */         {
/* 2609 */           logFile = new File(new StringBuilder().append(this.logDirectory.replace("\\", "/")).append("/").append(this.logBaseName).append(x).append(this.logOutputType ? ".html" : ".txt").toString());
/* 2610 */           x++;
/*      */         }
/*      */ 
/* 2613 */         logFile.createNewFile();
/*      */ 
/* 2615 */         if (this.SSH)
/*      */         {
/* 2617 */           this.SSHC.writeLogFile(logFile, this.logOutputType, this.dataLogStartLine);
/*      */         }
/*      */         else
/*      */         {
/* 2621 */           this.SC.writeLogFile(logFile, this.logOutputType, this.dataLogStartLine);
/*      */         }
/*      */       }
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/* 2627 */       e.printStackTrace();
/*      */     }
/*      */   }
/*      */ 
/*      */   public void lostOwnership(Clipboard aClipboard, Transferable aContents)
/*      */   {
/*      */   }
/*      */ 
/*      */   private void OpenEditorEvent()
/*      */   {
/*      */     Process proc;
/*      */     try
/*      */     {
/* 2644 */       Runtime rt = Runtime.getRuntime();
/* 2645 */       proc = rt.exec("/NotepadPP/notepadPP.exe");
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/*      */     }
/*      */   }
/*      */ 
/*      */   private void RemoveScriptButtonmouseReleased()
/*      */   {
/*      */     try
/*      */     {
/* 2662 */       int[] indices = this.LoadedScriptsList.getSelectedIndices();
/*      */ 
/* 2664 */       for (int x = indices.length - 1; x >= 0; x--)
/*      */       {
/* 2666 */         this.loadedFiles.remove(indices[x]);
/* 2667 */         this.scriptListModel.remove(indices[x]);
/*      */       }
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/*      */     }
/*      */   }
/*      */ 
/*      */   private void RunScriptEvent(String possibleFile)
/*      */   {
/*      */     try
/*      */     {
/* 2683 */       this.RunScriptButton.setEnabled(false);
/*      */ 
/* 2686 */       if (!this.oneScriptRunning)
/*      */       {
/* 2689 */         if ((this.activeScript != null) && 
/* 2690 */           (!this.activeScript.isAlive())) {
/* 2691 */           this.LM.resume();
/*      */         }
/*      */ 
/* 2694 */         this.activeScript = new Thread(possibleFile)
/*      */         {
/*      */           public void run()
/*      */           {
/*      */             try {
/* 2699 */               Communicator.access$1202(Communicator.this, true);
/* 2700 */               PythonInterpreter interp = new InteractiveInterpreter();
/*      */               String absolutePath;
/*      */               String absolutePath;
/*      */               String filename;
/* 2706 */               if (this.val$possibleFile.length() == 0)
/*      */               {
/* 2708 */                 if (Communicator.this.scriptFromComboBox)
/*      */                 {
/* 2710 */                   int index = Communicator.this.ScriptFolderComboBox.getSelectedIndex();
/*      */ 
/* 2712 */                   String filename = ((File)Communicator.this.loadedFileDirectory.get(index)).getName();
/* 2713 */                   String absolutePath = ((File)Communicator.this.loadedFileDirectory.get(index)).getAbsolutePath().replace("\\", "/").replace("/" + filename, "");
/* 2714 */                   filename = filename.replace(".py", "");
/*      */                 }
/*      */                 else
/*      */                 {
/* 2718 */                   int index = Communicator.this.LoadedScriptsList.getSelectedIndex();
/*      */ 
/* 2720 */                   String filename = Communicator.this.LoadedScriptsList.getSelectedValue().toString().replace(".py", "");
/* 2721 */                   absolutePath = ((File)Communicator.this.loadedFiles.get(index)).getAbsolutePath().replace("\\", "/").replace("/" + Communicator.this.LoadedScriptsList.getSelectedValue().toString(), "");
/*      */                 }
/*      */ 
/*      */               }
/*      */               else
/*      */               {
/* 2727 */                 String[] pathParts = this.val$possibleFile.split("/");
/* 2728 */                 absolutePath = "";
/*      */ 
/* 2730 */                 for (int x = 0; x < pathParts.length - 1; x++)
/*      */                 {
/* 2732 */                   absolutePath = absolutePath + pathParts[x] + "/";
/*      */                 }
/* 2734 */                 filename = pathParts[(pathParts.length - 1)].replace(".py", "");
/*      */               }
/*      */ 
/* 2749 */               interp.exec("import sys");
/* 2750 */               interp.exec("sys.path.append(\"" + absolutePath + "\")");
/* 2751 */               String temp = new File(".").getCanonicalPath().replace("\\", "/") + "/Jython/";
/*      */               try
/*      */               {
/* 2758 */                 interp.exec("sys.path.append(\"" + temp + "\")");
/* 2759 */                 interp.exec("sys.path.append(\"" + temp + "/Lib/" + "\")");
/* 2760 */                 interp.exec("sys.path.append(\"" + temp + "/Scripts/" + "\")");
/*      */ 
/* 2762 */                 interp.exec("import " + filename);
/* 2763 */                 interp.exec("reload(" + filename + ")");
/*      */ 
/* 2765 */                 interp.exec("from " + filename + " import main");
/* 2766 */                 PyObject pyObject = interp.get("main");
/*      */ 
/* 2769 */                 TreeMap te = new TreeMap();
/* 2770 */                 te.put(Communicator.this.connectionName, Communicator.this.LM);
/* 2771 */                 Object[] objectargs = { te };
/*      */ 
/* 2775 */                 newObj = pyObject._jcall(objectargs);
/*      */               }
/*      */               catch (Exception e)
/*      */               {
/*      */                 PyObject newObj;
/* 2779 */                 ByteArrayOutputStream BAOS = new ByteArrayOutputStream();
/* 2780 */                 PrintStream PS = new PrintStream(BAOS);
/* 2781 */                 e.printStackTrace(PS);
/* 2782 */                 String output = "\n" + BAOS.toString();
/* 2783 */                 JOptionPane.showMessageDialog(null, output, "Error", 0);
/*      */               }
/*      */ 
/* 2788 */               File delFile = new File(absolutePath + filename + "$py.class");
/* 2789 */               delFile.delete();
/*      */ 
/* 2795 */               Communicator.this.RunScriptButton.setEnabled(true);
/* 2796 */               Communicator.access$1202(Communicator.this, false);
/*      */             }
/*      */             catch (Exception e)
/*      */             {
/* 2800 */               e.printStackTrace();
/*      */ 
/* 2802 */               Communicator.this.RunScriptButton.setEnabled(true);
/* 2803 */               Communicator.access$1202(Communicator.this, false);
/*      */             }
/* 2805 */             Communicator.this.LM.errorCount = 0;
/*      */           }
/*      */         };
/* 2808 */         this.activeScript.start();
/*      */       }
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/* 2813 */       e.printStackTrace();
/*      */ 
/* 2815 */       this.RunScriptButton.setEnabled(true);
/* 2816 */       this.oneScriptRunning = false;
/*      */     }
/*      */   }
/*      */ 
/*      */   private void SaveButtonConfigEvent()
/*      */   {
/* 2824 */     JFileChooser fc = new JFileChooser();
/* 2825 */     fc.setCurrentDirectory(new File("Options/"));
/* 2826 */     int returnVal = fc.showSaveDialog(this.LoadScriptButton);
/*      */ 
/* 2829 */     FileWriter fis = null;
/* 2830 */     BufferedWriter out = null;
/*      */ 
/* 2832 */     if (returnVal == 0)
/*      */       try
/*      */       {
/* 2835 */         File file = fc.getSelectedFile();
/* 2836 */         fis = new FileWriter(file);
/*      */ 
/* 2838 */         out = new BufferedWriter(fis);
/*      */ 
/* 2840 */         Object[] keys = this.ToolBarMapping.keySet().toArray();
/*      */ 
/* 2842 */         for (int x = 0; x < keys.length; x++)
/*      */         {
/* 2844 */           out.write(new StringBuilder().append(Integer.parseInt(keys[x].toString()) + 50).append("/").append((String)this.ToolBarMapping.get(keys[x])).append("\n").toString());
/*      */         }
/*      */ 
/* 2848 */         out.close();
/*      */ 
/* 2850 */         fis.close();
/*      */       }
/*      */       catch (IOException e)
/*      */       {
/*      */       }
/*      */   }
/*      */ 
/*      */   private void ScriptFolderEvent()
/*      */   {
/*      */   }
/*      */ 
/*      */   private void setClipboardContents(String originator)
/*      */   {
/* 2869 */     StringSelection stringSelection = new StringSelection(this.ConsoleBox.getSelectedText());
/* 2870 */     Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
/* 2871 */     clipboard.setContents(stringSelection, this);
/*      */   }
/*      */ 
/*      */   public void setLM(LibraryMethods x) {
/* 2875 */     this.LM = x;
/*      */   }
/*      */ 
/*      */   private void setPassword(String x)
/*      */   {
/* 2884 */     this.password = x;
/*      */   }
/*      */ 
/*      */   private void setUsername(String x)
/*      */   {
/* 2893 */     this.username = x;
/*      */   }
/*      */ 
/*      */   public void StopScriptButtonmouseReleased()
/*      */   {
/* 2902 */     if (this.LM != null)
/* 2903 */       this.LM.hault();
/*      */   }
/*      */ 
/*      */   private void toggleBottomToolBar()
/*      */   {
/* 2910 */     this.BottomSSP.setVisible(!this.BottomSSP.isVisible());
/* 2911 */     this.PortOptionsToolBar.setVisible(!this.PortOptionsToolBar.isVisible());
/* 2912 */     this.BottomToolBarMenuItem.setText(new StringBuilder().append(this.BottomSSP.isVisible() ? "Hide " : "Show ").append("Bottom Tool Bar").toString());
/*      */     try
/*      */     {
/* 2915 */       if (isMaximum())
/*      */       {
/* 2917 */         setMaximum(false);
/* 2918 */         setMaximum(true);
/*      */       }
/*      */       else
/*      */       {
/* 2922 */         Rectangle r = getBounds();
/* 2923 */         reshape((int)r.getX(), (int)r.getY(), (int)r.getWidth(), (int)r.getHeight());
/*      */       }
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/* 2928 */       e.printStackTrace();
/*      */     }
/*      */   }
/*      */ 
/*      */   private void toggleButtons()
/*      */   {
/*      */     try
/*      */     {
/* 2939 */       if (this.TopToolBarMenuItem.getText().equals("Hide Top Tool Bar"))
/*      */       {
/* 2941 */         toggleTopToolBar();
/*      */ 
/* 2943 */         if (this.BottomToolBarMenuItem.getText().equals("Hide Bottom Tool Bar"))
/* 2944 */           toggleBottomToolBar();
/* 2945 */         if (this.SidePanelMenuItem.getText().equals("Hide Side Panel"))
/* 2946 */           toggleSideBar();
/* 2947 */         if (this.CommandBoxMenuItem.getText().equals("Hide Command Box"))
/* 2948 */           toggleCommandBox();
/*      */       }
/*      */       else
/*      */       {
/* 2952 */         toggleTopToolBar();
/*      */ 
/* 2954 */         if (this.BottomToolBarMenuItem.getText().equals("Show Bottom Tool Bar"))
/* 2955 */           toggleBottomToolBar();
/* 2956 */         if (this.CommandBoxMenuItem.getText().equals("Show Command Box"))
/* 2957 */           toggleCommandBox();
/* 2958 */         if (this.SidePanelMenuItem.getText().equals("Show Side Panel")) {
/* 2959 */           toggleSideBar();
/*      */         }
/*      */       }
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/* 2965 */       e.printStackTrace();
/*      */     }
/*      */   }
/*      */ 
/*      */   private void toggleCommandBox()
/*      */   {
/* 2973 */     System.out.println(this.VerticalSplitPanel.getDividerLocation());
/* 2974 */     System.out.println(this.VerticalSplitPanel.getMaximumDividerLocation());
/* 2975 */     System.out.println(this.CommandBoxMenuItem.getText().equals("Show Command Box"));
/* 2976 */     if (this.CommandBoxMenuItem.getText().equals("Show Command Box"))
/*      */     {
/* 2978 */       this.VerticalSplitPanel.setDividerLocation(0.7D);
/* 2979 */       this.CommandBoxMenuItem.setText("Hide Command Box");
/*      */     }
/*      */     else
/*      */     {
/* 2983 */       this.VerticalSplitPanel.setDividerLocation(10000);
/* 2984 */       this.CommandBoxMenuItem.setText("Show Command Box");
/*      */     }
/*      */   }
/*      */ 
/*      */   private void toggleSideBar()
/*      */   {
/* 2993 */     this.LoadScriptButton.setVisible(!this.LoadScriptButton.isVisible());
/* 2994 */     this.RemoveScriptButton.setVisible(!this.RemoveScriptButton.isVisible());
/*      */ 
/* 2996 */     if (!this.LoadScriptButton.isVisible())
/*      */     {
/* 2998 */       this.SidePanelMenuItem.setText("Show Side Panel");
/* 2999 */       this.HorizontalSplitPanel.setDividerLocation(10000);
/*      */     }
/*      */     else
/*      */     {
/* 3003 */       this.SidePanelMenuItem.setText("Hide Side Panel");
/* 3004 */       if (this.HorizontalSplitPanel.getDividerLocation() >= this.HorizontalSplitPanel.getMaximumDividerLocation() - 50)
/* 3005 */         this.HorizontalSplitPanel.setDividerLocation(0.8D);
/*      */     }
/*      */   }
/*      */ 
/*      */   private void toggleTopToolBar()
/*      */   {
/* 3013 */     this.TopSSP.setVisible(!this.TopSSP.isVisible());
/* 3014 */     this.TopToolBarMenuItem.setText(new StringBuilder().append(this.TopSSP.isVisible() ? "Hide " : "Show ").append("Top Tool Bar").toString());
/*      */     try
/*      */     {
/* 3017 */       if (isMaximum())
/*      */       {
/* 3019 */         setMaximum(false);
/* 3020 */         setMaximum(true);
/*      */       }
/*      */       else
/*      */       {
/* 3024 */         Rectangle r = getBounds();
/* 3025 */         reshape((int)r.getX(), (int)r.getY(), (int)r.getWidth(), (int)r.getHeight());
/*      */       }
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/*      */     }
/*      */   }
/*      */ 
/*      */   public void updateConnectionDirectory()
/*      */   {
/* 3038 */     Object current = this.connectionDirectoryModel.getSelectedItem();
/* 3039 */     this.connectionDirectoryModel.removeAllElements();
/* 3040 */     Object[] temp = TopLevelGUI.ConnectionDirectory.keySet().toArray();
/* 3041 */     this.connectionDirectoryModel.addElement("Connection Directory: ");
/* 3042 */     for (int x = 0; x < temp.length; x++)
/*      */     {
/* 3044 */       this.connectionDirectoryModel.addElement((String)temp[x]);
/*      */     }
/* 3046 */     this.connectionDirectoryModel.setSelectedItem(current);
/*      */   }
/*      */ 
/*      */   public void updateColorScheme()
/*      */   {
/* 3053 */     this.MainPanel.setBackground(TopLevelGUI.windowBackground);
/* 3054 */     this.HorizontalSplitPanel.setBackground(TopLevelGUI.windowBackground);
/*      */ 
/* 3057 */     this.LoadedScriptsLabel.setBackground(TopLevelGUI.windowBackground);
/* 3058 */     this.LoadedScriptsPane.setBackground(TopLevelGUI.windowBackground);
/* 3059 */     this.LoadedScriptsList.setBackground(TopLevelGUI.windowBackground);
/*      */ 
/* 3063 */     this.ConnectionDirectoryComboBox.setBackground(TopLevelGUI.windowBackground);
/* 3064 */     this.ScriptFolderComboBox.setBackground(TopLevelGUI.windowBackground);
/* 3065 */     this.RunScriptButton.setBackground(TopLevelGUI.windowBackground);
/* 3066 */     this.StopScriptButton.setBackground(TopLevelGUI.windowBackground);
/* 3067 */     this.LogDataButton.setBackground(TopLevelGUI.windowBackground);
/* 3068 */     this.EditScriptButton.setBackground(TopLevelGUI.windowBackground);
/* 3069 */     this.ConfigScriptFolderButton.setBackground(TopLevelGUI.windowBackground);
/* 3070 */     this.LoadScriptButton.setBackground(TopLevelGUI.windowBackground);
/* 3071 */     this.RemoveScriptButton.setBackground(TopLevelGUI.windowBackground);
/* 3072 */     this.ClearScreenButton.setBackground(TopLevelGUI.windowBackground);
/* 3073 */     this.DisconnectButton.setBackground(TopLevelGUI.windowBackground);
/* 3074 */     this.ConnectButton.setBackground(TopLevelGUI.windowBackground);
/* 3075 */     this.ExitButton.setBackground(TopLevelGUI.windowBackground);
/*      */ 
/* 3078 */     this.MenuBar.setBackground(TopLevelGUI.menuBackground);
/*      */ 
/* 3081 */     this.WindowMenu.setBackground(TopLevelGUI.menuBackground);
/* 3082 */     this.OpenEditorMenuItem.setBackground(TopLevelGUI.menuBackground);
/* 3083 */     this.SHButtonsMenuItem.setBackground(TopLevelGUI.menuBackground);
/* 3084 */     this.ExitMenuItem.setBackground(TopLevelGUI.menuBackground);
/*      */ 
/* 3087 */     this.ViewMenu.setBackground(TopLevelGUI.menuBackground);
/* 3088 */     this.FullTimestampMenuItem.setBackground(TopLevelGUI.menuBackground);
/* 3089 */     this.ShortTimestampMenuItem.setBackground(TopLevelGUI.menuBackground);
/* 3090 */     this.LineNumberMenuItem.setBackground(TopLevelGUI.menuBackground);
/* 3091 */     this.TopToolBarMenuItem.setBackground(TopLevelGUI.menuBackground);
/* 3092 */     this.SidePanelMenuItem.setBackground(TopLevelGUI.menuBackground);
/* 3093 */     this.BottomToolBarMenuItem.setBackground(TopLevelGUI.menuBackground);
/* 3094 */     this.CommandBoxMenuItem.setBackground(TopLevelGUI.menuBackground);
/*      */ 
/* 3097 */     this.CustomButtonsMenu.setBackground(TopLevelGUI.menuBackground);
/* 3098 */     this.RunScriptMenuItem.setBackground(TopLevelGUI.menuBackground);
/* 3099 */     this.LoadButtonConfigMenuItem.setBackground(TopLevelGUI.menuBackground);
/* 3100 */     this.SaveButtonConfigMenuItem.setBackground(TopLevelGUI.menuBackground);
/*      */ 
/* 3103 */     this.TopToolBar.setBackground(TopLevelGUI.windowBackground);
/* 3104 */     this.CustomButtonsToolBar.setBackground(TopLevelGUI.windowBackground);
/*      */ 
/* 3107 */     this.ConsoleBoxRightClickMenu.setBackground(TopLevelGUI.menuBackground);
/* 3108 */     this.ConsoleBoxCopyMenuItem.setBackground(TopLevelGUI.menuBackground);
/* 3109 */     this.ConsoleBoxPasteMenuItem.setBackground(TopLevelGUI.menuBackground);
/*      */ 
/* 3111 */     this.CommandBoxRightClickMenu.setBackground(TopLevelGUI.menuBackground);
/* 3112 */     this.CommandBoxCopyMenuItem.setBackground(TopLevelGUI.menuBackground);
/* 3113 */     this.CommandBoxPasteMenuItem.setBackground(TopLevelGUI.menuBackground);
/*      */ 
/* 3115 */     this.CustomButtonRightClickMenu.setBackground(TopLevelGUI.menuBackground);
/* 3116 */     this.CustomButtonChangeMenuItem.setBackground(TopLevelGUI.menuBackground);
/* 3117 */     this.CustomButtonDeleteMenuItem.setBackground(TopLevelGUI.menuBackground);
/*      */ 
/* 3119 */     this.ConsoleBoxBackgroundMenu.setBackground(TopLevelGUI.menuBackground);
/* 3120 */     this.ConsoleBoxForegroundMenu.setBackground(TopLevelGUI.menuBackground);
/*      */ 
/* 3122 */     this.CommandBoxBackgroundMenu.setBackground(TopLevelGUI.menuBackground);
/* 3123 */     this.CommandBoxForegroundMenu.setBackground(TopLevelGUI.menuBackground);
/*      */ 
/* 3126 */     this.MainPanel.setForeground(TopLevelGUI.windowText);
/* 3127 */     this.HorizontalSplitPanel.setForeground(TopLevelGUI.windowText);
/*      */ 
/* 3130 */     this.LoadedScriptsLabel.setForeground(TopLevelGUI.windowText);
/* 3131 */     this.LoadedScriptsPane.setForeground(TopLevelGUI.windowText);
/* 3132 */     this.LoadedScriptsList.setForeground(TopLevelGUI.windowText);
/*      */ 
/* 3136 */     this.ConnectionDirectoryComboBox.setForeground(TopLevelGUI.windowText);
/* 3137 */     this.ScriptFolderComboBox.setForeground(TopLevelGUI.windowText);
/* 3138 */     this.RunScriptButton.setForeground(TopLevelGUI.windowText);
/* 3139 */     this.StopScriptButton.setForeground(TopLevelGUI.windowText);
/* 3140 */     this.LogDataButton.setForeground(TopLevelGUI.windowText);
/* 3141 */     this.EditScriptButton.setForeground(TopLevelGUI.windowText);
/* 3142 */     this.ConfigScriptFolderButton.setForeground(TopLevelGUI.windowText);
/* 3143 */     this.LoadScriptButton.setForeground(TopLevelGUI.windowText);
/* 3144 */     this.RemoveScriptButton.setForeground(TopLevelGUI.windowText);
/* 3145 */     this.ClearScreenButton.setForeground(TopLevelGUI.windowText);
/* 3146 */     this.DisconnectButton.setForeground(TopLevelGUI.windowText);
/* 3147 */     this.ConnectButton.setForeground(TopLevelGUI.windowText);
/* 3148 */     this.ExitButton.setForeground(TopLevelGUI.windowText);
/*      */ 
/* 3151 */     this.MenuBar.setForeground(TopLevelGUI.menuText);
/*      */ 
/* 3154 */     this.WindowMenu.setForeground(TopLevelGUI.menuText);
/* 3155 */     this.OpenEditorMenuItem.setForeground(TopLevelGUI.menuText);
/* 3156 */     this.SHButtonsMenuItem.setForeground(TopLevelGUI.menuText);
/* 3157 */     this.ExitMenuItem.setForeground(TopLevelGUI.menuText);
/*      */ 
/* 3160 */     this.ViewMenu.setForeground(TopLevelGUI.menuText);
/* 3161 */     this.FullTimestampMenuItem.setForeground(TopLevelGUI.menuText);
/* 3162 */     this.ShortTimestampMenuItem.setForeground(TopLevelGUI.menuText);
/* 3163 */     this.LineNumberMenuItem.setForeground(TopLevelGUI.menuText);
/* 3164 */     this.TopToolBarMenuItem.setForeground(TopLevelGUI.menuText);
/* 3165 */     this.SidePanelMenuItem.setForeground(TopLevelGUI.menuText);
/* 3166 */     this.BottomToolBarMenuItem.setForeground(TopLevelGUI.menuText);
/* 3167 */     this.CommandBoxMenuItem.setForeground(TopLevelGUI.menuText);
/*      */ 
/* 3170 */     this.CustomButtonsMenu.setForeground(TopLevelGUI.menuText);
/* 3171 */     this.RunScriptMenuItem.setForeground(TopLevelGUI.menuText);
/* 3172 */     this.LoadButtonConfigMenuItem.setForeground(TopLevelGUI.menuText);
/* 3173 */     this.SaveButtonConfigMenuItem.setForeground(TopLevelGUI.menuText);
/*      */ 
/* 3176 */     this.TopToolBar.setForeground(TopLevelGUI.windowText);
/* 3177 */     this.CustomButtonsToolBar.setForeground(TopLevelGUI.windowText);
/*      */ 
/* 3180 */     this.ConsoleBoxRightClickMenu.setForeground(TopLevelGUI.menuText);
/* 3181 */     this.ConsoleBoxCopyMenuItem.setForeground(TopLevelGUI.menuText);
/* 3182 */     this.ConsoleBoxPasteMenuItem.setForeground(TopLevelGUI.menuText);
/*      */ 
/* 3184 */     this.CommandBoxRightClickMenu.setForeground(TopLevelGUI.menuText);
/* 3185 */     this.CommandBoxCopyMenuItem.setForeground(TopLevelGUI.menuText);
/* 3186 */     this.CommandBoxPasteMenuItem.setForeground(TopLevelGUI.menuText);
/*      */ 
/* 3188 */     this.CustomButtonRightClickMenu.setForeground(TopLevelGUI.menuText);
/* 3189 */     this.CustomButtonChangeMenuItem.setForeground(TopLevelGUI.menuText);
/* 3190 */     this.CustomButtonDeleteMenuItem.setForeground(TopLevelGUI.menuText);
/*      */ 
/* 3192 */     this.ConsoleBoxBackgroundMenu.setForeground(TopLevelGUI.menuText);
/* 3193 */     this.ConsoleBoxForegroundMenu.setForeground(TopLevelGUI.menuText);
/*      */ 
/* 3195 */     this.CommandBoxBackgroundMenu.setForeground(TopLevelGUI.menuText);
/* 3196 */     this.CommandBoxForegroundMenu.setForeground(TopLevelGUI.menuText);
/*      */ 
/* 3198 */     pack();
/*      */   }
/*      */ 
/*      */   public void focusGained(FocusEvent fe)
/*      */   {
/*      */     try
/*      */     {
/* 3212 */       if (fe.getSource() == this.ScriptFolderComboBox)
/*      */       {
/* 3214 */         this.scriptFromComboBox = true;
/*      */         try
/*      */         {
/* 3218 */           File folder = new File(((File)this.loadedFileDirectory.get(0)).getAbsolutePath().replace(((File)this.loadedFileDirectory.get(0)).getName(), ""));
/* 3219 */           this.scriptFolderModel.removeAllElements();
/* 3220 */           this.loadedFileDirectory.clear();
/*      */ 
/* 3223 */           File[] temp = folder.listFiles();
/* 3224 */           for (int x = 0; x < temp.length; x++)
/*      */           {
/* 3226 */             if (temp[x].getName().contains(".py")) {
/* 3227 */               this.loadedFileDirectory.add(temp[x]);
/*      */             }
/*      */           }
/* 3230 */           for (int x = 0; x < this.loadedFileDirectory.size(); x++)
/*      */           {
/* 3232 */             this.scriptFolderModel.addElement(((File)this.loadedFileDirectory.get(x)).getName());
/*      */           }
/*      */ 
/*      */         }
/*      */         catch (IndexOutOfBoundsException ioobe)
/*      */         {
/*      */         }
/*      */ 
/* 3240 */         this.LoadedScriptsList.clearSelection();
/* 3241 */         this.LoadedScriptsPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
/* 3242 */         this.ScriptFolderComboBox.setBorder(BorderFactory.createLineBorder(new Color(0, 200, 0), 2));
/*      */       }
/*      */       else
/*      */       {
/* 3246 */         this.scriptFromComboBox = false;
/* 3247 */         this.LoadedScriptsPane.setBorder(BorderFactory.createLineBorder(new Color(0, 200, 0), 2));
/* 3248 */         this.ScriptFolderComboBox.setBorder(BorderFactory.createLineBorder(UIManager.getColor("ComboBox.buttonShadow"), 1));
/*      */       }
/*      */ 
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/* 3254 */       e.printStackTrace();
/*      */     }
/*      */   }
/*      */ 
/*      */   public void focusLost(FocusEvent fe)
/*      */   {
/*      */   }
/*      */ 
/*      */   public void internalFrameClosing(InternalFrameEvent e)
/*      */   {
/* 3278 */     ExitEvent();
/*      */   }
/*      */ 
/*      */   public void internalFrameClosed(InternalFrameEvent e)
/*      */   {
/*      */   }
/*      */ 
/*      */   public void internalFrameOpened(InternalFrameEvent e)
/*      */   {
/*      */   }
/*      */ 
/*      */   public void internalFrameIconified(InternalFrameEvent e)
/*      */   {
/*      */   }
/*      */ 
/*      */   public void internalFrameDeiconified(InternalFrameEvent e)
/*      */   {
/*      */   }
/*      */ 
/*      */   public void internalFrameActivated(InternalFrameEvent e)
/*      */   {
/*      */   }
/*      */ 
/*      */   public void internalFrameDeactivated(InternalFrameEvent e)
/*      */   {
/* 3305 */     windowSize = getBounds();
/*      */   }
/*      */ 
/*      */   static
/*      */   {
/* 3451 */     COLORS.put("WHITE", new Color(16777215));
/* 3452 */     COLORS.put("MAGENTA", new Color(8323113));
/* 3453 */     COLORS.put("RED", new Color(9371648));
/* 3454 */     COLORS.put("GREEN", new Color(29184));
/* 3455 */     COLORS.put("YELLOW", new Color(9408256));
/* 3456 */     COLORS.put("GRAY", new Color(5592405));
/* 3457 */     COLORS.put("ORANGE", new Color(9388288));
/* 3458 */     COLORS.put("BLUE", new Color(98));
/* 3459 */     COLORS.put("CYAN", new Color(22102));
/* 3460 */     COLORS.put("PINK", new Color(12330534));
/* 3461 */     COLORS.put("BLACK", new Color(0));
/*      */   }
/*      */ }

/* Location:           F:\6-30-2012\Hazell\
 * Qualified Name:     hmc.Communicator
 * JD-Core Version:    0.6.0
 */